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