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

    EJB-QL join with UNIDIRECTIONAL relationship

    micho

      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
      { ..
      }