How to I create an HQL query to return objects in a many to many relationship?
- by Dave
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.