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 count()
PostPosted: Wed May 11, 2005 10:19 am 
Newbie

Joined: Tue May 10, 2005 5:29 pm
Posts: 3
Hibernate version:2.1.8

I've got what seems to be a common problem using Criteria. It doesn't support aggregation. I've read several forums which reference a count() method of Criteria that is available via a patch. What I've read indicates it is available in either 2.1.7 or 2.1.8, however I can't seem to find it. I only need this for basic constrained count functionality and would love to know how to access this method. Any help would be appreciated.

Thanks.
Bob


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 10:44 am 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
The documentation states that projections and aggregations are only available through HQL for version 2.1.x

It looks like criteria.count existed for a moment but that it has been removed from the API.

Read at the bottom (maybe that's the patch you were refering to)
http://opensource.atlassian.com/project ... wse/HB-474


If you upgrade to hibernate version 3.0, it does support aggregations through its criteria API.

If this is the case, you do that using criteria.setProjection(Projections.count("field"))

Good luck

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 11:25 am 
Newbie

Joined: Tue May 10, 2005 5:29 pm
Posts: 3
That was one of the postings I had read. Looks like it was fleeting and I have to use HQL. Thanks for taking the time to respond.

Bob


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.