Hibernate Collection chaining

Posted by Anantha Kumaran on Stack Overflow See other posts from Stack Overflow or by Anantha Kumaran
Published on 2010-03-31T06:22:34Z Indexed on 2010/03/31 6:23 UTC
Read the original article Hit count: 615

Filed under:
|

I have two Entities

University   
   courses

Course
   students

i want to access all the students in a university. I tried the following query

select u.courses.students from university u

i got the following exception.

org.hibernate.QueryException: illegal attempt to dereference collection [university0_.id.courses] with element property reference [students] [ select u.courses.students from com.socialsite.persistence.University u  ]
    at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:46)
  .....

can anyone explain what is wrong with this?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about collections