Hibernate version:2.1.7
Even if session.delete() fails, and raises HibernateException, Hibernate marks the object as deleted
I am trying to figure out whether the StaleObjectStateException is being raised because
1. A row with the specified ID did not exist - "usr-msg: Contact System Administrator"
2. This row was updated in another session - "usr-msg - This data was updated by another user. please requery."
The Hibernate Exceptions raised is - net.sf.hibernate.ObjectDeletedException
Exception.getMessage() - The object with that id was deleted: 999109, of class: mypackage.Auditable
try
{
sess.delete(a_object);
sess.flush();
}
catch(HibernateException he)
{
if (he instanceof StaleObjectStateException)
{
Object row;
try
{
row = sess.get(a_object.getClass(), ((StaleObjectStateException)he).getIdentifier());
}
catch(HibernateException he2)
{
row = null;
}
if ( row== null)
throw new NoDataFoundException(he);
else
throw new VersionMismatchException(he);
}
}
[/b]
Thanks and Regards
Gaurav Madan
|