Question About Fk refrence in The Collection
Posted
by Ahmed
on Stack Overflow
See other posts from Stack Overflow
or by Ahmed
Published on 2010-06-07T09:58:18Z
Indexed on
2010/06/07
10:02 UTC
Read the original article
Hit count: 221
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
© Stack Overflow or respective owner