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?
|