I have mapped the class hierarchy in NHibernate. Plain:
class abstract Animal
class Dog : Animal
class Cat: Animal
class Cow: Animal
In the mapping, I have the discriminator values set in the ANIMAL_TYPE column:
Dog -> dog
Cat -> cat
Cow -> cow
All kinds of queries work. Other than that, when I need to get objects of two specific types. I wrote like this:
QueryOver.Of<Animal>().Where(animal => animal is Dog || theme is Cat)
And I do not get any results. When I look at the generated request, NHibernate generates:
(this_.ANIMAL_TYPE = @p0 or this_.ANIMAL_TYPE = @p1)
which is great, but the values in the parameters @ p0 and @ p1 contain the full name of the class, for example.
Zoo.Model.Cat
instead of the discriminator values. How can i solve this? Should I keep discriminator values in sync with type names? I would like to avoid this if possible.