I didn't know that attribute existed! Thanks a lot. And yes, it's a table per class hierarchy. I said per concrete class because of the approach I was applying: "having 2 classes in separate tables, but the tables are the same one, and using implicit polimorphysm"
Thanks a lot again! On 16 feb, 04:17, hival <[email protected]> wrote: > the following somewhat abbreviated mapping work > btw the strategy you described is called "Table per class hierarchy" > > <?xml version="1.0" encoding="utf-8" ?> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="NHTest" namespace="NHTest.Model" auto-import="true"> > > <class name="ApplicationContact" table="contacts"> > <id name="Id" column="Id"> > <generator class="native" /> > </id> > > <discriminator type="string" formula="case when PersonName is > not > null then 0 else 1 end" /> > <many-to-one name="Application" column="ApplicationId" not- > null="true" /> > > <subclass name="IndividualContact" discriminator-value="0"> > <property name="PersonName" column="PersonName" > not-null="true" /> > </subclass> > > <subclass name="GroupContact" discriminator-value="1"> > <property name="GroupName" column="GroupName" > not-null="true" /> > </subclass> > </class> > > <class name="Application" table="application"> > <id name="Id" column="Id"> > <generator class="native" /> > </id> > > <bag name="Contacts" cascade="all-delete-orphan" > inverse="true"> > <key column="ApplicationId" /> > <one-to-many class="ApplicationContact"/> > </bag> > </class> > </hibernate-mapping> -- 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.
