In hibernate how to confirm/verify whether session.save(entity), session.delete(entity) and session.update(entity) operations have been executed successfully w/o making another call to db?
I mean if you delete an entity how do you confirm its deleted. can it be done w/o making another call to the database?
You should watch out for
HibernateException, a sub-class ofRuntimeExceptionif you want to catch failures of save/update/delete calls with entities on the session object. If the exception is not thrown, then it means the operation is successful.If you use JPA semantics, then
PersistenceExceptionis the counter-part ofHibernateExceptionthat you should watch out to handle such failure scenarios.