-->
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: FlushModeType.MANUAL and merge() incomaptibility,please help
PostPosted: Wed Mar 11, 2009 11:21 am 
Newbie

Joined: Tue Oct 21, 2008 4:32 am
Posts: 3
I am trying to detect changes made to the entity before commiting the transaction. I'm successufully using the following algorithm:

1. Clone managed entity to a new one by copying all the arrtibutes
2. Refresh the managed entity to lose all the changes
3. Compare these objects to see where changes occured
4. Merge the cloned entity so that the changes were saved eventually

This artificial detaching single entity is working great for me, but not when entityManager uses FlushModeType.MANUAL. In that mode merging throws
Code:
StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Can anyone help me bypass that?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 5:31 am 
Newbie

Joined: Tue Oct 21, 2008 4:32 am
Posts: 3
FYI: MANUAL mode works fine with merge(). I had a fatal typo - setter of field used for JPA optimistic locking was private, so cloned entity just had to be considered obsolete. Thanks anyway :)


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.