I'm using the NHibernate criteria API to load some entities from my database. My domain consists of an abstract class, Animal, which the concrete Cat class inherits from. Another concrete class, Tiger, inherits from Cat.
I need to load all Cats from the database, so I'm doing the following-
ICriteria criteria = session.CreateCriteria(typeof(Cat));
return criteria.List<Cat>();
What I'm finding is that both Cats and Tigers are returned by the query instead of just Cats. This makes sense, as a Tiger is a Cat. But in this particular case I only want Cats, and not the additional Tigers.
Does anyone know how I can achieve this?