I have two classes, "Serie" and "Commentaire".
Classe "Serie" have a field named Comment of type "Commentaire".
So the mapping is done with a many-to-one relation.
When I update a Serie objet, I've got a LazyInitialisationException : "Illegally attemped to associate a proxy with two opened Sessions."
If in the Serie mapping file I change the cascade="all" with "none", that's Ok, but the field Comment is not update...
What's wrong, to update the field Comment (and the object Commentaire) when I update the Serie object ?
Thanks.
Serie mapping :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Donnees.Serie, Lucrece" table="SERIE">
<id name="Id" column="SER_ID" >
<generator class="guid" />
</id>
<property name="Mnemonique" column="SER_MNEMO" type="String" />
<property name="Libelle" column="SER_LIBELLE" type="String" />
<property name="DateMaj" column="SER_DATEMAJSERIE" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="DateCreation" column="SER_DATECREATION" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="temp1" column="UTIL_ID" type="guid" />
<property name="temp2" column="PER_ID" type="guid" />
<many-to-one name="Comment" column="COM_ID" class="Donnees.Commentaire, Lucrece" cascade="all" />
</class>
</hibernate-mapping>
Commentaire mapping :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Donnees.Commentaire, Lucrece" table="COMMENTAIRE">
<id name="Id" column="COM_ID" >
<generator class="guid" />
</id>
<property name="Texte" column="COM_TEXTE" type="String" />
</class>
</hibernate-mapping>