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: Pagination: Number of results
PostPosted: Wed Oct 06, 2004 4:21 am 
Newbie

Joined: Wed Oct 06, 2004 4:15 am
Posts: 16
Hibernate version: 2.1.6

Hi All,

I was reviewing the post from Gavin King about pagination, in http://blog.hibernate.org/cgi-bin/blosx ... ation.html.

The implementation is really nice, but I wonder if it's possible not only to know if there are pages before and after the requested page, but also to know the number of total pages (or total results of the query being paginated).

Of course that I can make another query with (select count(*)...), but the question is, can I make this with only one query?? (i.e. using the query object enclosed in the page implementation from Gavin?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 4:26 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This is not possible in one query, even without Hibernate.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 6:59 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
It is possible with Scrollable Resultset - You go to last row and get row number

It is only one query

regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 19, 2004 7:15 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
in sql server you can assign multiple result sets to a stored procedure also, so your last select would be the count, and so (without hibernate) in jdbc you would make several calls to getResultSet().


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.