HQL: illegal attempt to dereference collection
Posted
by
skip
on Stack Overflow
See other posts from Stack Overflow
or by skip
Published on 2011-06-19T20:23:14Z
Indexed on
2011/06/20
16:22 UTC
Read the original article
Hit count: 210
The situation is like this:
I have an entity Book that holds a one-to-many relationship with Chapter.
Now if I try the query, "from Book book inner join book.chapters chapter where chapter.title like '%hibernate%'
", it gives me the desired result.
But if I try, "from Book where book.chapters.title like '%hibernate%'
", I get the error illegal attempt to dereference collection.
The thing is that I only want the collection of Book objects in return and not a collection of pair of Book and Chapter objects in return which I get with the former query.
Could someone help me understand?
© Stack Overflow or respective owner