unable to catch org.hibernate.StaleObjectStateException while deleting record that doesn't exists in database
Posted
by
JAB
on Stack Overflow
See other posts from Stack Overflow
or by JAB
Published on 2011-11-25T09:16:52Z
Indexed on
2011/11/25
9:50 UTC
Read the original article
Hit count: 225
My application has a delete user option. Now in order to check concurrency condition I tried the following use case
- opened application in chrome and firefox browser.
- deleted user in firefox
- now trying to delete the same user in chrome browser I get exception
org.hibernate.StaleObjectStateException
.. which is right .. since I am trying to delete an object which doesn't exists. But I am not able to catch this exception
try{
getHibernateTemplate().delete(userObj);
} catch (StaleObjectStateException e) {
e.printStackTrace();
}
How do i catch this exception ??
© Stack Overflow or respective owner