Below are the HQL queries for a specific type of class.
select a from Animal a where TYPE(a) in ('Cat', 'Dog') and a.sex = 'Male' order by a.name select a from Animal a where a.class in ('Cat', 'Dog') and a.sex = 'Male' order by a.name
I am wondering if there is an equivalent using QueryOver?
You can use the QueryOver GetTypeextension IsInmethod to accomplish this:
GetType
IsIn
session.QueryOver<Animal>() .Where(a => a.GetType().IsIn(new[] { "Cat", "Dog" }) /* .. etc */
You must use the discriminator values that your NHibernate mapping uses.