These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Many-to-one and LazyInitialisationException
PostPosted: Fri Aug 18, 2006 9:01 am 
Newbie

Joined: Fri Aug 18, 2006 7:30 am
Posts: 5
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>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.