Perhaps I am misunderstanding here, but after the first call above to session.getTransaction().commit(); the entity is not detached. Detached indicates there is a corresponding row in the database, which is not the case here. What am I missing?
If X is a removed entity instance, an IllegalArgumentException will be thrown by the merge operation (or the transaction commit will fail).
That is talking about the removed status, which is true before the flush+commit. After the commit, the entity is gone. |