-->
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: Getting Distinct Count of a Projection
PostPosted: Wed Jun 20, 2007 4:25 pm 
Newbie

Joined: Tue Apr 10, 2007 10:40 am
Posts: 8
I'd like to get the distinct row count of a Projection. Can this be done or is there a better way to accomplish the same thing?

Code:
Projection p = Projections.projectionList().add( Projections.property( "_prop1" ), "prop1" ).add( Projections.property( "_prop2" ), "prop2" );
// Now I want to get a distinct count of p - I don't see a way in Projections to accomplish this!


We're using the Criteria API in Hibernate 3.2.1


Top
 Profile  
 
 Post subject: countDistinct
PostPosted: Wed Jun 20, 2007 5:13 pm 
Beginner
Beginner

Joined: Thu Jan 13, 2005 10:50 am
Posts: 30
Location: Minneapolis, MN
Try using countDistinct method of class Projections.
Somehow you have to use CountProject class.

_________________
** Rate me if the solution was useful **

Regards,
Paras Jain


Top
 Profile  
 
 Post subject: Projections.count* Takes a Property
PostPosted: Thu Jun 21, 2007 8:58 am 
Newbie

Joined: Tue Apr 10, 2007 10:40 am
Posts: 8
Thanks for pointer, but CountProjection accepts a property, not a Projection. We're looking to get the count of a Projection. I'm worried this isn't possible because it's a "Bad Idea", but I can't imagine why. So I need help making the choice one way or the other - if it can be done, how? If not, why not?
Thanks for your time!


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.