users@glassfish.java.net

Re: entityManager problem related to flush?

From: <glassfish_at_javadesktop.org>
Date: Fri, 29 Jun 2007 11:37:17 PDT

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