-->
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: Criteria version of grouping by an inner join column?
PostPosted: Wed Nov 21, 2007 11:31 am 
Beginner
Beginner

Joined: Wed Nov 21, 2007 10:24 am
Posts: 25
Say for example I mapped my tables and wanted to do a query like this using Criteria (already got it working in HQL, but keeping query languages to a minimum would be nice), how would I write this using Criteria queries?

select job.* FROM job INNER JOIN partLI ON partLI.jobID=job.id INNER JOIN part ON partLI.part = part.num GROUP BY part.num,job.due

job, partLI, and part are all mapped classes where job has a collection of partLI and each partLI has a part as well as some other attributes. I'm having difficulty finding out how to use the projection to group this. Each different way I try leads to an exception saying it can't find part.num (or parts.part.num or job.parts.part.num).

Edit: Actually I don't even have it how I want in the HQL. When I do group by part.num and j.due, only one job shows up per part number. How could I get it so it's like a collection with the part number as the key and a list of jobs as the value? Or am I trying to make Hibernate do something it can't?


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.