Dear all,
I have the following problem :
-> I have a class, FormulaireAdhesionPersistent, which contains a tab of DemandeAdhesionValeur.
-> The key of DemandeAdhesionPersistent is generated with a sequence
When I update FormulaireAdhesionPersistent, hibernate create new instance for each elements of the tab of DemandeAdhesionPersistentinstead of updating it !!!
Java as follows :
Code:
public class FormulaireAdhesionPersistent
implements Serializable
{
private String numFormulaireAdhesion ; // key
...
...
private DemandeAdhesionPersistent listeDemandeAdhesion[] ;
...
...
}
public class DemandeAdhesionPersistent
{
private int numDemandeAdhesion ; // key
...
...
private FormulaireAdhesionPersistent formulaireAdhesion ;
...
...
}
Mapping as follows :
Code:
<hibernate-mapping>
<class name="FormulaireAdhesionPersistent" table="FORMULAIRE_ADHESION">
<id name="numFormulaireAdhesion" column="PK_FORMULAIRE_ADHESION">
<generator class="assigned"/>
</id>
...
...
<set name="listeDemandeAdhesion" lazy="true" inverse="true">
<key column="FK_NUM_FORMULAIRE"/>
<one-to-many class="DemandeAdhesionPersistent"/>
</set>
...
...
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="fr.gouv.finances.dgi.opale.commun.transverse.persistent.DemandeAdhesionPersistent" table="DEMANDE_ADHESION">
<id name="numDemandeAdhesion" column="PK_DEMANDE_ADHESION" type="int" unsaved-value="any">
<generator class="sequence">
<param name="sequence">S_DEMANDE_ADHESION</param>
</generator>
</id>
...
...
<many-to-one name="formulaireAdhesion" column="FK_NUM_FORMULAIRE" cascade="none" class="FormulaireAdhesionPersistent" not-null="true"/>
...
...
</class>
</hibernate-mapping>
Thanks for your help[/code]