Hello,
is it possible to query for the amount of rows (objects) in a database?
Ok, I know it is possible by HQL query (select coutn(obj) from ...), but what about Cirteria queries?
I want to know how many objects for a certain criteria exist (e.g. 100 000), but I do not want NHibernate to create all the objects.
For example I have the following code:
Code:
....
Example example = Example.Create( myPerson )
.IgnoreCase()
.ExcludeNulls()
.EnableLike()
.ExcludeZeroes();
IList list = session.CreateCriteria( myPerson.GetType() )
.Add( example )
.SetMaxResults( start )
.SetFirstResult( max )
.List();
....
The code limits the returned results by the use of the methods "SetMaxResults" and "SetFirstResult" (I implemented a kind of paging)
Additonally I want to know the total amount of objects returned, without the use of the methods "SetMaxResults" and "SetFirstResult".
Is it possible to query for this amount without receiving all the objects?
Thank you for your answers
SunaX