-->
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: "Group By - Having Count" with criteria
PostPosted: Tue Jun 30, 2009 8:22 am 
Beginner
Beginner

Joined: Wed Nov 17, 2004 11:15 am
Posts: 25
Hi,

I'm trying to achive a "group by xxx having count(*) > 1"-select using criteria.
So far I achieved the "group by"-part (see below).

Code:
Criteria symbolCriteria = getSession().createCriteria(Symbol.class, "sym");
Criteria symbolVarianteCriteria = symbolCriteria .createCriteria(Symbol.REF_VARIANTEN, "sym_va");
Criteria imageDataCriteria = symbolVarianteCriteria.createCriteria(SymbolVariante.PROPERTY_IMAGEDATA, "imgd");
       
ProjectionList projections = Projections.projectionList();
projections.add(Projections.groupProperty("sym_va." + SymbolVariante.PROPERTY_COLOR));
projections.add(Projections.groupProperty("imgd." + ImageData.PROPERTY_FILENAME));
symbolCriteria .setProjection(projections);
       
final List symbols = symbolCrit.list();


But I still haven't found the solution for the "having count(*) > 1"-part.
Is this possible?

Thanks
Jonny

_________________
Cheers
Jonny


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.