Hello everyone,
Let's consider domain, when people can have animals - either dogs or
cats. What criteria or HQL should i use when searching for animal
owner by specific animal parameters like CatName = 'cat' and DogAge >
5.

Sorry for AR attributes, but the question is about NH queries

        [ActiveRecord("Persons")]
        public class Person
        {
                [HasMany]
                IEnumerable<Animal> Animals { get; set; }
        }

        [ActiveRecord("Animals", DiscriminatorColumn = "AnimalType",
DiscriminatorValue = "0")]
        public abstract class Animal
        {
                [BelongsTo]
                public Person Owner { get; set; }
        }

        [ActiveRecord("Animals", DiscriminatorValue = "1")]
        public class Cat : Animal
        {
                [Property]
                public string CatName { get; set; }
        }

        [ActiveRecord("Animals", DiscriminatorValue = "1")]
        public class Dog : Animal
        {
                [Property]
                public int DogAge { get; set; }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to