-->
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: Circular entity mapping and NonUniqueObjectException
PostPosted: Tue Feb 22, 2005 4:08 am 
Newbie

Joined: Tue Feb 22, 2005 3:26 am
Posts: 8
Mapping documents:

<hibernate-mapping>
<class name="model.Unit" table="UNIT">
<id name="id" type="string" unsaved-value="null">
<column name="UNITID"/>
<generator class="uuid.hex"/>
</id>
<property name="name" column="NAME" not-null="true"/>
<property name="description" column="DESCRIPTION"/>
<many-to-one name="parentUnit" column="PARENT_UNITID" class="model.Unit"/>
<set name="units" table="UNIT" cascade="all" lazy="true" inverse="true">
<key column="PARENT_UNITID"/>
<one-to-many class="model.Unit"/>
</set>
</class>
</hibernate-mapping>


Unit.java:

public class Unit {
private String id = null;
private String name = null;
private String description = null;
private Unit parentUnit = null;
private Set units = new HashSet();
// getter and setter methods
}


When I want to update an unit, I got the exceptions below, the save method works well.

Full stack trace of any exception that occurs:

net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 2c9081b90238110701023811a13a0003, of class: model.Unit
at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:1686)
at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1452)
at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1479)
at net.sf.hibernate.impl.SessionImpl.update(SessionImpl.java:1364)
......


Thank you in advance!


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.