-->
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: net.sf.hibernate.NonUniqueObjectException
PostPosted: Tue Apr 05, 2005 6:09 pm 
Newbie

Joined: Thu Mar 03, 2005 1:52 pm
Posts: 5
I have a many-to-many associations using an association table

<class name="Deal" table="DEAL">
<id name="dealId" column="DEAL_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">DEAL_ID_SEQUENCE</param>
</generator>
</id>

<idbag name="partyDealAssocList" lazy="false" cascade="save-update" table="PARTY_DEAL_ASSOC" order-by="party_profile_id">
<collection-id type="long" column="PARTY_DEAL_ASSOC_ID">
<generator class="sequence">
<param name="sequence">PARTY_DEAL_ASSOC_SEQ</param>
</generator>
</collection-id>
<key column="DEAL_ID"/>
<many-to-many class="PartyProfile" column="party_profile_id"/>
</idbag>
...
</class>




My Association Table has
DEAL_ID
PARTY_PROFILE_ID





Lets say
Deal1 -> PartyProfile1

Then I create a copy of Deal1, but Deal2 still needs to point to B1 so
Deal2 -> PartyProfile1

This one saves properly. But on the next httprequest I opened both Deal1 and Deal2 in the same session.
Deal1 opens a PartyProfile with similar PartyProfileID as Deal2, but they do not reference the same object

When I commit the transaction I'm getting the exception:
net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session


Can I load both Deal1 and Deal2 in a single session and they point to a single reference of PartyProfile?


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.