-->
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.  [ 3 posts ] 
Author Message
 Post subject: update after load gives error
PostPosted: Wed Nov 02, 2005 12:49 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
Hibernate version: 3.0
I am using jta transaction. I dont close session and I dont have transaction in my hibernate classes. I control transaction in m ejb methods:@TransactionAttribute(TransactionAttributeType.REQUIRED)

Problem: I want to load an object , change sth in it and then update it. In hibernate2 there was no problem but in hibernate3, when I do the load or get before update I get this error: "a different object with the same identifier value was already associated with the session".

How can I work with a different session to let my update works?

What is the solution?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 4:36 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Try using that first (the one that is already in the session) object.

Or you can get a new session out of the session factory - SessionFactory.openSession().


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 8:34 am 
Newbie

Joined: Tue Oct 11, 2005 4:38 pm
Posts: 7
Perhaps it is not necessary to call update, when you already associated the object during loading. Just delete the update call. Hibernate will update it anyway, because it knows you changed it.

If that does not help, post your hashcode() and equals() please


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.