Hi there,
I have Cat, Dog, Tiger entities, and Animal entity as base class. Mapping to this is "table per subclass". Also, Person class has many Animals, using "bag" xml-element (bidirectional relation).
Each Cat and Tiger has property as ClawSize. But this property (assuming it is not significant to Dog nor Animal) will NOT belong to Animal nor Dog.
I want to fetch all people (Persons :) ) that conform at lease one of these criteria:
Any cat having ClawSize > 10 units, or any tiger having ClawSize > 15 units.
All I want to query it at one round trip, i.e. to generate one sql.
And also I want to prefetch (eager load), all animals of each person, i.e. not only those matching the criteria (but it's not that important).
Can someone provide any help, please. Using ICriteria would be much better, but I couldn't do by it. So I tried with HQL, and no success. In native sql, I can, but I dont think it would be best practice using this in NHibernate (or Hibernate).
NHibernate build version: 1.2.1.4000.
|