-->
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.  [ 4 posts ] 
Author Message
 Post subject: NHibernate equivalent to session.iterate?
PostPosted: Tue Aug 09, 2005 1:14 pm 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Hi,

Is there an equivalent in NHibernate to the session.iterate in the Hibernate docs?

They suggest using something like the following to get the number of entities in a collection:

Code:
You can find the size of a collection without initializing it:

( (Integer) session.iterate("select count(*) from ....").next() ).intValue();


but I can't figure out how to do this in NHibernate.

Cheerio,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 10:28 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Try
Code:
(int) session.Find("select count(*) from ....")[0];

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 12:58 pm 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Thanks KPixel - will do.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 3:19 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Actually, the direct equivalent of session.iterate() is session.Enumerable().


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

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.