| The entity does get deleted. The problem is that the entity being re-persisted still has the (non-null) ID set. Since the ID is annotated with @GeneratedValue, Hibernate's implementation of EntityManager#persist assumes that a non-null ID indicates that the entity is detached (not transient). The test will pass if the entity is merged instead of re-persisting. Also, the test will pass if the ID is set to null before re-persisting the entity. |