Hi,
I have a little problem using Projections with Criteria, i'm using hibernate
3.1
This simple query works:
 Criteria criteria = getSession().createCriteria(VolumeDatiGenerali.class);
 criteria.setMaxResults(25);
 criteria.setFirstResult(25 * pageNumber);
 criteria.setProjection( Projections.projectionList().add(
Projections.rowCount(), "totalRecords"));
 List list = criteria.list();
My list object contains 25 records but when i'm trying to use the
Projections.rowCount() method in my second query, the list object is empty
and no exceptions are throwned:
 Criteria criteria = getSession().createCriteria(VolumeDatiGenerali.class);
 criteria.setMaxResults(25);
 criteria.setFirstResult(25 * pageNumber);
 criteria.setProjection( Projections.projectionList().add(
Projections.rowCount(), "totalRecords"));
 List list = criteria.list();
Any suggestions??
Thanks in advice,
Omar

Reply via email to