I am confused on the use of session.filter to query a collection.
I have a class, Animal, that has a collection of Tattoos. I want to execute a query that selects animals based on the value of the tattoo (tattoo has several properties, value, location, etc.). Session.filter sounds like what I want, except the first parameter to the method is the collection and I am not sure where I obtain the collection from. Do I have to query all animals first (there are no other limiting criteria on the animals selected so I would select every animal in the database!) and then loop through the list of animals calling session.filter for each?
I am hoping to use session.filter to select only animals with a certain tattoo. In essence the SQL I need to end up with is:
Code:
Select animal from animal, tattoo
where animal.id = tattoo.animalId and tattoo.value = 'ABC123'