-->
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: Exception when updating the state of a ManyToMany collection
PostPosted: Fri Apr 02, 2010 3:48 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
I have spent several hours trying to solve this problem and posting here as my last resort.

I have a system where offers are sent to recipients. There is a many-to-many relationship between Offer and Recipient. Recipient has a unique key on the email address.

The following pseudo-test describes the problem. The test passes if the session is not cleared in step 3.

1. Create an offer with recipient R.
2. Save the offer to the database: [b]session.saveOrUpdate(offer)[/b]
3. session.flush(); session.clear(); - this simulates the submission of an HTML form which uploads an update to the first name of recipient R
4. Look up recipient R from the database by email address. Hibernate returns a different object R' representing the same recipient.
5. R'.setFirstName("New First Name")
6. session.saveOrUpdate(offer) -> [b]throws org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [Recipient#16665][/b]

I will appreciate any help on this.

Thanks.


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.