How to I create an HQL query to return objects in a many to many relationship?
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-03-21T03:46:12Z
Indexed on
2010/03/21
3:51 UTC
Read the original article
Hit count: 434
Hi there. I have an application that includes 2 classes Club and Article. These are mapped in Hibernate as a many to many relationship.
As a result, hibernate has created a table called CLUB_ARTICLE which it uses to manage the many to many relation ship. The CLUB and ARTILCE tables have no direct reference to each other and the mapping is only represented in the CLUB_ARTICLE table.
I need to create an HQL query that returns a list of articles for a particlular club. So I need to supply the club id and get back a list of Article objects that belong to it. For some reason, I just can't work out how to do this. Any help would be very much appriciated!
Thanks.
© Stack Overflow or respective owner