I found following information from the spec. But it's not clear enough for me who is not an english native.
The
PostPersist
andPostRemove
callback methods are invoked for an entity after the entity has been made persistent or removed. These callbacks will also be invoked on all entities to which these operations are cascaded. ThePostPersist
andPostRemove
methods will be invoked after the database insert and delete operations respectively. These database operations may occur directly after the persist, merge, or remove operations have been invoked or they may occur directly after a flush operation has occurred (which may be at the end of the transaction). Generated primary key values are available in thePostPersist
method.
My question is any transaction related jobs can be rolled back after @PostRemove
?
Let's say my entity deletes some offline files on @PostRemove
class MyEntity {
@PostRemove
private void onPostRemove() {
// delete offline files related to this entity
// not restorable!
}
}
Is it possible that those offline files deleted from the storage and the entity still left in the database? (by rollback?)