-->
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.  [ 2 posts ] 
Author Message
 Post subject: NonUniqueObjectException (two ref. from same obj)
PostPosted: Fri Nov 26, 2004 12:18 pm 
Newbie

Joined: Sat Sep 25, 2004 12:03 pm
Posts: 5
Hi,
When i load my parent object, it seems that hibernate load the same child object twice, because it can be found in a map and in a many-to-one relation, so i have tried to set cascade=none in the many-to-one relation, but with no success, i cannot change my db model because sometime, the object in the many-to-one relation is not in the map.

Here is the mapping:

<many-to-one
name="firsttaskparameter"
class="com.recruitsoft.rcc.persistence.hibernate.Taskparameter"
not-null="true"
cascade="none"
>
<column name="FIRSTTASKPARAMETERNO" />
</many-to-one>

<map
name="taskparameters"
lazy="true"
inverse="true"
order-by="taskparameterno asc"
cascade="all-delete-orphan"
>
<key>
<column name="TASKNO" />
</key>
<index column="TASKPARAMETERNO" type="java.lang.Long"/>
<one-to-many
class="com.recruitsoft.rcc.persistence.hibernate.Taskparameter"
/>
</map>



Exception is: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 308, of class: .....persistence.hibernate.Taskparameter

Thanks

Richard


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 2:08 pm 
Newbie

Joined: Mon Sep 06, 2004 1:39 pm
Posts: 18
Location: Utah, USA
I had a similar exception today. In my case I needed to change 'generator class="identity"'. I am using MySQL and identity is supported for MySQL. I'm not sure it is even related. Good Luck.


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

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.