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: 'Count' tip in the 1.2 documentation tips 'n tricks
PostPosted: Thu Oct 26, 2006 12:30 pm 
Beginner
Beginner

Joined: Sat Sep 09, 2006 5:55 am
Posts: 23
From the docs:
Quote:
11.13. Tips & Tricks

You can count the number of query results without actually returning them:

Code:
IEnumerator countEn = session.Enumerable("select count(*) from ....").GetEnumerator();
countEn.MoveNext();
int count = (int) countEn.Current;


Other than looking like a workaround, this uses obsolete code (session.Enumerable); it might be better to change it to:

Code:
int count = (int) session.CreateQuery("select count(*) from ...").UniqueResult();


Update: jira seems to be back online now, so I created an issue for this: http://jira.nhibernate.org/browse/NH-780

_________________
Cheers,

Guy Mahieu


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.