Я делаю что-то глупое и просто не вижу этого.
Я просто хочу, чтобы класс Party имел набор PartyNames, используя приведенное ниже сопоставление, и не могу вставить PartyName с нарушением ограничения FK.При необходимости опубликует объектный код, но подозревает, что это отображение1011 *
<class name="Party" table="Parties">
<id name="Id">
<column name="PartyId" />
<generator class="hilo" />
</id>
<discriminator column="Type" not-null="true" type="string" />
<set access="field.camelcase-underscore" cascade="all-delete-orphan" inverse="true" name="Names">
<key foreign-key="Party_PartyName_FK">
<column name="PartyNameId" />
</key>
<one-to-many class="Parties.Domain.Names.PartyName, Parties.Domain" />
</set>
<subclass
name="Parties.Domain.People.Person, Parties.Domain"
discriminator-value="PERSON"
>
</subclass>
Отображение (PartyName)
<class name="PartyName" table="PartyNames">
<id name="Id">
<column name="PartyNameId" />
<generator class="hilo" />
</id>
<natural-id>
<many-to-one access="field.camelcase-underscore" class="Parties.Domain.Party" foreign-key="Party_FK" name="Party" cascade="save-update">
<column name="PartyId" index="PartyIndex" not-null="true" />
</many-to-one>
<property name="RequiredName" not-null="true" length="50"/>
</natural-id>
<property name="EverythingElse" />
<property name="ContextUsed" length="50"/>
<property name="Salutation" length="20"/>
<property name="EffectivePeriod" type="Smack.Core.Data.NHibernate.UserTypes.DateRangeUserType, Smack.Core.Data">
<column name="EffectiveStart"/>
<column name="EffectiveEnd"/>
</property>