Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Criteria with a one-to-many association

 
Caleb TheChosen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an Order entity (that, well, represnts an order), and each order has a set of DeliveryDates.
I'm trying to implement a search function and show the results in a JFace TableViewer.

I want that for every order that has more than one delivery date, it should be duplicated in the table, but the DeliveryDate column would display the specific delivery date for this instance.

This query is easily done in SQL using a simple join, and the rows are duplicated with a different date for every row.
Since I'm doing a search feature, I'm building the query in steps (depending on what search parameters the user had chosen), so building a query using Criteria is very useful. The problem is, that the result list I get is duplicated (which is OK), but every entity simply contains the same set of DeliveryDates - so I can't print a different date for different rows of the same Order.

Is there any way to do this using Critera? And if not, how can I do it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic