-->
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: StaleObjectStateException with strange state values
PostPosted: Tue Jul 24, 2012 4:24 am 
Newbie

Joined: Tue Jul 24, 2012 3:41 am
Posts: 1
Hi,

The scenario:

I'm working with some pojo Article.

1) createSession()
2) session.merge(Article )
3) session.saveOrUpdate(Article)
3) closeSession()
// Article dbVersion=2
....
4) createSession()
5) session.merge(Article )
Here I'm getting StaleObjectStateException with strange state values. When I inspect in debugger variables of DefaultMergeEventListener.entityIsDetached() I see that entity.dbVersion=2, while target.dbVersion=1.
So, the target variable contains very old version of the Article. How can I prevent loading of old version? (where does it come from?)

The application is multi-threaded in its nature, however the process of handling of Article instance is serial, so I don't see place for multi-threaded collisions. Of course, each thread is using different instance of Session.


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.