JPA/Hibernate remove entity sometimes not working

Replacing the cascade = CascadeType.ALL by orphanRemoval = true in the @OneToMany association gives the expected result: The child records are correctly removed without the need to delete the parent record.

Pity that error is not logged more clearly.


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.