3 Replies Latest reply on Feb 26, 2007 6:22 PM by Micho Edershvili

    EJB-QL join with UNIDIRECTIONAL relationship

    Micho Edershvili Newbie

      I have a UNIDIRECTIONAL ManyToMany Relationship between useres and usergroups. Users know their usergroups, usergroups don´t know their users.

      I want to create a query to get all Usergroups which are referenced by a User with name 'john'

      I tried:

      select ug from UserGroup as ug, User as u join u.userGroupList where u.name = 'john'
      
      but got an empty result, what´s wrong?

      @Entity
      public class User implements Serializable
      { ...
       public String getName()
       @ManyToMany
       public List<UserGroup> getUserGroupList()
      
      @Entity
      public class UserGroup implements Serializable
      { ..
      }