-->
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: Projections.countDistinct() with combination of properties
PostPosted: Mon Dec 22, 2008 12:19 pm 
Newbie

Joined: Fri Oct 10, 2008 9:17 am
Posts: 13
Geetings,

This is just a quick 'is this possible' kind of question. We need to count the number of hits for a query using Projection. Because of a number of left outer joins in the query we need to make the root entity distinct - this seems simple enough using one property:

Code:
criteria.setProjection( Projections.countDistinct("eventCode") );   


The problem is we need the distinction to be made based on a combination of two properties in the root entity, not just one.

Is this at all possible with using Projections?

Basically the resultant sql needs to have the same effect as this:
Code:
select count(distinct event_code,event_name ) from event;


Regards,
Alan.


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.