Question About Fk refrence in The Collection
- by Ahmed
Hi ,
i have 2 entities : ( person ) & (Address)
with follwing mapping :
<class name="Adress" table="Adress" lazy="false">
<id name="Id" column="Id">
<generator class="native" />
</id>
<many-to-one name="Person" class="Person">
<column name="PersonId" />
</many-to-one>
</class>
<class name="Person" table="Person" lazy="false">
<id name="PersonId" column="PersonId">
<generator class="native" />
</id>
<property name="Name" column="Name" type="String" not-null="true" />
<set name="Adresses" lazy="true" inverse="true" cascade="save-update">
<key>
<column name="PersonId" />
</key>
<one-to-many class="Adress" />
</set>
</class>
my propblem is that when i set Adrees.Person with new object of
person ,The collection person.Adresses doesn't update itself .
should i update every end role of the association to be updated in the
two both?
another thing : if i updated the Fk manually like this :
Adress.PersonId it doesn't break or change association. does this is
Nhibernte behavior ?
thanks in advance , i am waiting for your experiencies