-->
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: Criteria Query result set size
PostPosted: Thu Nov 09, 2006 6:57 pm 
Newbie

Joined: Tue Jul 19, 2005 1:28 pm
Posts: 17
Hi,

I would like to retreive the size of a criteria query result set but I dont seem to find a way to do it. For example there are around 70,000 entries in my table, I use a criteria query to filter it down to may be around 15,000 entries. If I try to pull all the 15,000 entries it throws outofmemory exception. So I am planning to use a Paged query but I will need to first show the user how many results are actually present (15,000). I know I can pull the no of results using something like select count(*) from ... but I have to use criteria query to fill in the where conditions and once I build the criteria query there is no way for me to pull the size of the result without initializing the collection. I tried a couple of things like adding Projections.distinctCount, Projections.rowCount but they do not seem to work or are giving incorrect results.

Is there any way to get the size of the result set using critieria query and without initializing the collection.

Thanks in advance.

Phani


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.