What is strange is that remove followed by merge causes an IllegalArgumentException:
Code: Select all
Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.ObjectDeletedException: deleted instance passed to merge
but the remove itself seems not to be successful (even accounting for the fact that a "successful" remove could be rolled back) because the @PostRemove ELCM is not triggered before the merge failure. So delete->merge causes an exception where the deletion is blamed for the failure of the merge, but the deletion itself seems not to have completed pre-commit in the first place.
I have tested this with various SOPs and of course the annotated ELC methods.