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
|