i am having this problem too, but after all i could got this working. My original query was:
Code:
from Library lb where lb.disabled = false and lb.books.id = :bId
i wanted to fetch libraries for specific book. In jboss 4.0.3SP1 (not sure what hibernate version it has) this query works perfectlu, but in jboss 4.2.0GA this shows me the illegal attempt to dereference collection exception.
I changed to this query:
Code:
from Library lb left join lb.books b where lb.disabled = false and b.id = :bId
and it works!
But the problem is: result list is not of my Entity Type.
The first query returns a list of Libraries, so i can iterate it with the form:
Code:
for(Library lb: em.createQuery(query).getResultList())
{
}
the second query returns a list the Libraries (at least i would guess that), but when i iterate it at the same form, i get this exception:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to entity.Library
i also tried with this query:
Code:
from Library lb, IN (lb.books) b where lb.disabled = false and b.id = :bId
but i get the same exception..
what am i doing wrong? do i need some special configuration or something?
Thanks