The default transaction attribute for methods in a SLSB is "REQUIRES". So, if deleteTest is called by itself, a new transaction is created by the container and commited at the end of the method. If deleteTest is called from modifyTest, it inherits the transaction from modifyTest, and the transaction is *not* commited at the end of deleteTest. This is the reason, why you have to manually flush the removal to avoid the unique key violation.
Anyway, you should use em.merge to save instance modifications, and not delete and create.
[Message sent by forum member 'mf125085' (mf125085)]
http://forums.java.net/jive/thread.jspa?messageID=224727