-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Doubt with paging in criteria query
PostPosted: Fri Mar 11, 2005 1:30 am 
Newbie

Joined: Fri Feb 18, 2005 9:23 am
Posts: 10
hi ,

i have doubt with paging

here is my code

Criteria crit = session.createCriteria(TokenImpl.class);
Criterion userEq=Expression.eq("actorId",actorId);
crit.add(userEq);
// there may be more filters

crit.setFirstResult(startingRecordNo);
crit.setMaxResults(noOfRecords);

is there any method to get the total count of records with that criteria . ( like crit.totalRecords or something like that )

see i need to show (records 1 to 10 of 50 ) kind of report
or shall i use another count(*) query for that one with same filtering options .

please suggest me a best way to do this

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 8:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hibernate 3 has much more capabilities in the Criteria API - check here for some examples: http://www.gloegl.de/blog/archives/hibe ... ancements/


Top
 Profile  
 
 Post subject: Doubt with paging in criteria
PostPosted: Fri Mar 11, 2005 10:27 am 
Newbie

Joined: Fri Feb 18, 2005 9:23 am
Posts: 10
Sorry I forget to mention that i am using hibernate 2

it is presently impossible for me to shift to hibernate 3

then what will be the alternative

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 12:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is none. - There is a patch somewhere in JIRA you might apply that adds count() to criteria.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.