-->
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: Optimistic locking
PostPosted: Fri May 08, 2015 3:14 am 
Newbie

Joined: Fri May 08, 2015 3:01 am
Posts: 1
Hello,

My application uses Spring with Hibernate, the current design works absolutely fine for single users. However when the multiple users are involved on a distributed cluster based servers, many times user's face 'Optimistic Locking/Stale Object' exception occurs.

The exception is particularly thrown at "findbyId(id).." method. The structure is as below..

Outermethod(){

saveDetails(destinationObject);--This method is non-Transactional and performs update with No flush...

storeinDB(destinationObject.getID()); --This method is transactional.
}
@Transactional(noRolebackFor...)
storeinDB(ID){
destinationObject.findbyId(ID);---here the optimistic is thrown
few lines of business logic;
gethibernateTemplate().update();
}


Please help me understand:

1) does findbyID() look in cache or DB ?
2) What is the possible to change or suggestions to avoid optimistic loc?

Thanks in advance.
Deepti


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.