Hi,
I've the following 2 mappings (and classes) i,
Code:
<class name="ph.news.model.UtenteBase" table="ph_diadoracommunity_users">
<id name="id" type="int" column="u_id" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="name"/>
<one-to-one name="datiLivello1" class="ph.news.model.DatiLivello1" cascade="all"/>
</class>
<class name="ph.news.model.DatiLivello1" table="ph_diadoracommunity_users_lv1">
<id column="u_id" type="int">
<generator class="foreign">
<param name="property">utenteBase</param>
</generator>
</id>
<one-to-one name="utenteBase" class="ph.news.model.UtenteBase" constrained="true"/>
<property name="city"/>
</class>
f I manually insert data into DB all works: when I load a ph.news.model.UtenteBase by primary Id the object has datiLivello1 property loaded BUT if I modify the ph.news.model.UtenteBase object an then I perform:
Code:
sess = this.getSession();
tx = sess.beginTransaction();
sess.update(u);
sess.flush();
I see that hibernate try to make an INSERT of datiLivello1 data AND NOT an update so there is an exception.
Do you know why?