| 
					
						 net.sf.hibernate.QueryException: expecting 'elements' or 'indices'
 
 hi,
 sorry for my stupid questions, but I really do not have the slightest idea how to elegantly query many:many relations. 
 
 Assume I have a m:m mapping Person[uid, name] : Group[uid, name]. I want to retrieve all People that are member of Group "ABC"
 
 ------------------
 hbm for Person:
 ---------------------
 <set name="groups"
             table="HIB_GROUPS_UID_PEOPLE_UID"
             lazy="true"
             inverse="false"
             cascade="none"
             sort="unsorted"
         >
 <key column="PEOPLE_UID" />
 <many-to-many
                   class="org.xinity.ams.GroupsStub"
                   column="GROUPS_UID"
                   outer-join="auto"
               />
 </set>
 ------------------
 hbm for Groups:
 ---------------------
 <set name="people"
             table="HIB_GROUPS_UID_PEOPLE_UID"
             lazy="true"
             inverse="false"
             cascade="none"
             sort="unsorted"
         >
 <key column="GROUPS_UID"/>
 <many-to-many
                   class="org.xinity.ams.PersonStub"
                   column="PEOPLE_UID"
                   outer-join="auto"
               />
 </set>
 
 I am doing so, using:
 
    net.sf.hibernate.Query q = sess.getHibernateSession().createQuery("from c in class Groups where c.name=?");
    q.setString (0, name);
    q.list().iterator.next().getPeople()
 
 
 The problem is: I want to query for some Person-attributes like ZIPCode etc., too. In a single query. So I want to do s.th. like
 
    "where c.zipCode = 12345 AND c.groups.name = "ABC"
 
 but I am getting a 
 expecting 'elements' or 'indices' after: c.groups.name [from c in class Person WHERE(c.groups.name = 'ABC')]
 
 What am I doing wrong? 
					
  
						
					 |