users@glassfish.java.net

Re: java.lang.IllegalStateException for Transaction

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 Jul 2008 17:13:15 PDT

Curiouser and curiouser.

I changed the code in beforeCompletion to call a SLSB, that does an Entity Manager call to persist the Audit information.

So, from what I can gather here, this is what I see happening:

- Servlet calls SLSB to update domain object
- JPA looks up sequence info, and send an INSERT to the DB.
- TransactionSyncrhonizer.beforeComplete fires, and sends auditing info to a different SLSB
- At that point, I hit the JPA to do a lookup, and the JPA tries to write my original domain object to the DB again, and I get a duplicate insert error.

So I take it that the JPA is "unstable" at this point, and not usable. Within the lifecycle metthods.

Note, this was happening in a normal everyday transaction, not within the multiple REQUIRES_NEW transactions of the original issue.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=284290