I have entities similar to:
ProductLine: id, name
ProductLineContents: content_id, product_line_id
Content: id, text, updated_time
What I'd like to do is: for each product line, get the latest content (so if theres two content entries associated to one product line, the latest updated_time is rturned, and if one content item is associated to two product lines, it is returned twice). Something similar to:
select content.* from productline
inner join productlinecontents
inner join content;
However I can't seem to figure out how to have Hibernate Criteria return a different entity than the original one it was created with. So if I wanted to start the criteria at the product line with createCriteria(ProductLine.class) along with the proper joins, then it only returns ProductLine objects, but I need Content objects.
What's the best way to accomplish this?
The actual data model is much more complex and can't be modified