2 Replies Latest reply on May 4, 2008 8:40 PM by Sander S

    Search and many to many relationship

    Tomas Cerny Novice

      Hello,


      I use seam search EntityQuery.
      Old versions of hibernate allowed things like this (RESTRICTIONS):



      person.exam.contestSet.id



      which asks collection of contests for its ID. This was taken off, because it was wrong. In older hibernate it worked.


      What am I supposed to do now?


      I have tried to do this


      person.exam
      in ( select ex from Exam ex, Contest contest where contest in (ex.contestSet) and contest.id = #{contest.id})



      this is accepted by HQL, but the SQL is generated wrong:


         ....
                 where
                      exam1_.id=contestset3_.examId 
                      and contestset3_.contestId=contest4_.id 
                      and (
                          contest2_.id in (
                              .
                          )
                      ) 
                      and contest2_.id=?
              ) limit ?
      



      it contains . inside in.


      I got similar result for this query:


      person.exam in (select contest.examExecutionSet from Contest contest where contest.id = #{contest.id})




      I have hibernate.jar 3.2.6.GA and MySQL JDBC connector 5.0.8


      Is that hibernate problem or is my query wrong?
      Or seam add something to it.


      Thank you