-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL question: "next 30 results"
PostPosted: Wed Jul 12, 2006 3:34 pm 
Newbie

Joined: Tue Sep 13, 2005 6:35 pm
Posts: 2
Hibernate version:
3.0.5

Hibernaters,

I am wondering if there is any way in HQL to select, say, the 51st-100th rows of a query. I am trying to implement what some websites do when they say "click here to see the next 50 results". I'm guessing this can be done with sub-queries but is there any way to do it with Criteria queries?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 3:39 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Did you look at Criteria.setMaxResults(int) method? Combine that with ordering your results by some criteria (Criteria.addOrder(Order.asc/desc)), and maybe you could get what you needed.
HTH,

Bratek


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 10:09 pm 
Beginner
Beginner

Joined: Mon Oct 11, 2004 2:22 am
Posts: 41
org.hibernate.Query.setMaxResults(int)
and
org.hibernate.Query.setFirstResult(int)

these two will allow you to do range results (as supported by your jdbc driver) for things like pagination etc.

(gimme credits :D)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.