Announcement Announcement Module
Collapse
No announcement yet.
Help with nested select on relationship table in hql or criteria Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with nested select on relationship table in hql or criteria

    Hi,

    I have a relationship like below.

    [Exercise] hasMany [Muscles]

    it generates 3 tables

    1. Exercise
    2. Muscles
    3. Exercise_Muscles

    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.

    thanks!
Working...
X