Let the setter for Person.Pet check the type and set People.TypeOfPet
(which would not be a special field as far as nhibernate is
concerned). Use table-per-concrete-class (<union-subclass>) for the
pet classes.

/Oskar


2010/1/19 Barry Dahlberg <[email protected]>:
> Hi,
>
> I have a fixed legacy database with a table structure like to this:
>
>    People
>        TypeOfPet
>
>    Cat
>        OwnerId
>
>    Dog
>        OwnerId
>
> I would like to map this classes like this:
>
>    Person
>        Pet
>
>    Pet
>        Owner
>
>    Cat : Pet
>
>    Dog : Pet
>
> Notice that the ideal discriminator, TypeOfPet, is in the People table
> which is mapped to Person.  I want to be able to assign a new pet to a
> person which should update TypeOfPet.
>
> Does NHibernate have a way of mapping this directly?
>
> Cheers
> Barry
>
> --
> 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.
>
>
>
>
-- 
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