-->
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.  [ 1 post ] 
Author Message
 Post subject: Total amount in pagination
PostPosted: Mon May 04, 2009 4:54 pm 
Newbie

Joined: Mon May 04, 2009 2:53 pm
Posts: 1
Hi, maybe this question was answered in a previous post, but I've read most of them and I couldn't solve my problem. I need to obtain the total amount of elements when the query is paginated, so I can show the user the amount of pages and elements.
In this post viewtopic.php?f=1&t=944387&p=2248404&hilit=pagination+count#p2248404 there is a solution regarding this problem. The solution is to create another query that uses count() , here is some code from that solution:

Code:
session.createQuery( "select count(*) from (" + originalQuery + ")");


I've tried this, but I couldn't make it work since I get a QuerySyntaxException
An example of originalQuery in my case could be

select ac.manager from Account ac where ac.balance > :balance

I'm using hibernate 3.2.0ga and Postgres db

Is it really possibly to do that? I've read in the documentation that subselects are only allowed in select an where clause.

Sorry if a missed the post that I need and generates a duplicated one.

Thanks


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

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.