Hello all,
I have two classes, Owner and Pet.
A Owner has a Pet, but a Pet does not know about it's Owner.
So I am attempting to write a named query in order to find an Owner when I have a Pet.
My thought is that I can take the petId and look through all Owners, look at the Owner's PetList, check if the PetList contains a Pet with the PetId I am looking for, return that Owner.
Query so far...(not correct)
Code:
<query name="Owner.findByPet">
<![CDATA[from Owner o where o.petList contains Pet p where p.id = ?]]>
</query>
Any hints would be appreciated!