How do I retrieve a list of base class objects without joins using NHibernate ICriteria?

Posted by Kristoffer on Stack Overflow See other posts from Stack Overflow or by Kristoffer
Published on 2009-12-10T21:43:14Z Indexed on 2010/03/24 14:33 UTC
Read the original article Hit count: 436

Filed under:
|

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 "pure" Pet objects (not cats or dogs, just pets), without making any joins to the other tables?

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about icriteria