I'm sure this question has been asked before but I can't seem to find an answer on these forums.
I am trying to get a collection of objects from a grandparent object.
This is the basic setup:
Code:
Class Clinic{
Set<Owner> owners;
}
Code:
Class Owner {
Set<Pet> pets;
}
I want to get all the pets from a Clinic. So something along the lines of
Code:
select clinic.owners.pets where clinic.id = :id
clinic.owners.pets won't work because of "dereferencing a collection" exception
I also tried something like
Code:
select o.pets from owner o join c.owners with clinic c where c.id = :id
That didn't work either