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
|