-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria API and count(*)
PostPosted: Fri Jun 16, 2006 3:24 am 
Newbie

Joined: Fri Jun 16, 2006 3:14 am
Posts: 2
Location: Bagkok, Thailand
Is it possible to use projection like count(*) with criteria API?

I just want to count the row without query all data. (I prefer Criteria API because it much easier than HQL). I know that this feature exists in Hibernate but I can not find it in NHibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 4:00 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Projection in the Criteria API is a Hibernate V3 implementation. Since the current NHibernate version is based on the Hibernate V2 code it's not supported yet. There's an entry in JIRA to get it ported over, but unless you've got the time to do it yourself you'll need to wait for someone else.

On a side note, if you search the Hibernate forum you'll find that there were hacks out there for the Hibernate V2 to introduce support for getting count - I think they were pretty simple, so you could hack your version of NHibernate to add that support yourself.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 12:35 pm 
Newbie

Joined: Fri Jun 16, 2006 3:14 am
Posts: 2
Location: Bagkok, Thailand
Thanks Symon. I've decided to use HQL because I have'nt really got the time :( but may be I will search the Hibernate forum like you've suggested later when I have time.

Thanks,

Atipon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.