JPA/Hibernate remove entity sometimes not working

Do you have associations in this graph that cascade a persist back to the thing being deleted? If so, the JPA spec states clearly that the provider is to cancel the delete in such a case. If this is the case, Hibernate writes out a log statement saying “un-scheduling entity deletion […]”. You could see that by enabling trace logging on the org.hibernate.event.internal.DefaultPersistEventListener logger.

If this is the situation, you’ll need to clean up those associations as required by JPA specification.

Leave a Comment