-->
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: version check not working with executeUpdate.
PostPosted: Mon Sep 23, 2013 2:53 am 
Newbie

Joined: Mon Sep 23, 2013 2:35 am
Posts: 1
Hi,


I am facing following issue with version(Optimistic lock).
the version check is not happening and exception stale state Exception not thrown when i use below query.
User details and version no incrementing properly but it is not throwing exception when version no is not equal.
try{
Query query= getSessionFactory().getCurrentSession().createQuery("update versioned User u set u.userName=:userName,u.DOB=:DOB where u.userID= :id " );
query.setString("userName", usrName);
query.setString("DOB",dob);
query.executeUpdate()
getSessionFactory().getCurrentSession().flush();
}catch(StaleStateException e){
return "some to notify user "
}
Same thing working fine if use below query.

try{

getSessionFactory().getCurrentSession().update(user);
getSessionFactory().getCurrentSession().flush();

}catch(StaleStateException e){
return "some to notify user "
}

any suggestion in this regard will be much helpfull


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.