Hibernate version:2
I have a Criteria generated by user actions (user can define some filters and so...).
But now, there are too many records, so criteria.list() takes a very long time and becose I just need primary keys of this records,
I wish to use somethilng like this...
( method getCriteria() generates Criteria by user actions and so..)
Code:
ArrayList idList = new ArrayList();
Criteria crit = getCriteria();
Object obj = crit.uniqueResult();
if ( obj == null) {
log.error( "nothing found...");
return idList;
} else{
String primaryKeyPropertyName = HibernateProvider.primaryKeyPropertyName( obj);
log.debug( "primary key: " + primaryKeyPropertyName);
}
and then I wish to select primary keys from database by Criteria
(not whole objects, but only primary keys... )
and put them into
idList
is it possible?
thanx...