10 December 2010

Handling 2 one-to-many relationships in JPQL


I had the following scenario:

I've Entry Department that is has one-to-many relationship with Employee and also had a one-to-many relationship with (say) Section.
And I need to Join these three entities, I've used the following query :
select d from Department d join d.employees e join d.sections s

And the generated SQL was correct.
Post a Comment