Behaviour of @Post callback methods i.e. @PostUpdate, @PostCreate etc. in
JPA 2.0
Hi All,
I am not able to understand the exact behavior of @Post callback methods.
As mention in ProJPA book "When the SQL for deletion of an entity finally
does get sent to the database, the PostRemove event will get fired. As
with the PostPersist lifecycle event, the PostRemove event does not
guarantee success. The enclosing transaction may still be rolled back".
My concern here is, if SQL DELETE statement is already fire then how
transaction will be rolled back? If SQL DELETE statement is not able to
delete the object then exception will be thrown and @PostDelete will not
be executed. So, under what scenario transaction can be rolled back??
Thanks all for your time!!
No comments:
Post a Comment