I have two objects with a many-to-many relationship, to stay with the examples in the reference manual say I have a Cat object which has one or more kitten objects in a Set 'kittens'. I run into trouble when I want to make a simple query to fetch all Cats who have a kitten of a specific color.
I tried something like:
Code:
from Cat as cat WHERE cat.kittens.color = 'green'
this gives "illegal attempt to dereference collection" exception however. How can I tell Hibernate to simply go through the colors of the kittens of a Cat and compare them to a given parameter?
Thanks for any help!