Let's say I have a base class called Pet and two subclasses Cat and Dog that inherit Pet.
I simply map these to three tables Pet, Cat and Dog, where the Pet table contains the base class properties and the Cat and Dog tables contain a foreign key to the Pet table and any additional properties specific to a cat or dog. A joined subclass strategy.
Now, using NHibernate and ICriteria, how can I get a list of all the different pets as Pet objects, not Cat or Dog objects - just plain Pet objects, without making any joins to the other tables? I am only interested in the information contained in Pet.
I just did something similar and found this blog post by Ayende extremely helpful! I went with a joined-subclass approach and it nicely supports querying the base class.
However, to find "only pets" without joining I think you'd need the table-per-class hierarchy approach. Or, you could use the table-per-subclass and just do left joins on the subclasses and restrict it to rows that had no matches on any of the left joins.