Mar 4th, 2012, 10:19 PM
Help with nested select on relationship table in hql or criteria
I have a relationship like below.
[Exercise] hasMany [Muscles]
it generates 3 tables
I'm trying to perform the following sql in hql form or criteria form.
"select a.* from Exercise a where a.id in (select distinct (b.id) from Exercise_Muscles b where b.muscle_id in (11,12))"
since the Exercise_muscles relationship table is not represented by a domain class, I'm having problem figuring out how to translate this sql into hql or criteria format.
Any tips that could point me in the right direction would be much appreciated.
Tags for this Thread