[jboss-dev-forums] [JBoss Transactions Development] - EnityManager.close() before or after JTA afterCompletion()?
seyvet
do-not-reply at jboss.com
Mon Jan 28 12:33:50 EST 2013
seyvet [https://community.jboss.org/people/seyvet] created the discussion
"EnityManager.close() before or after JTA afterCompletion()?"
To view the discussion, visit: https://community.jboss.org/message/794692#794692
--------------------------------------------------------------
Hi,
See as a reference the https://community.jboss.org/message/794633#794633 thread.
In an application server, that is JavaEE 6 compliant, which of EntityManager.close() and JTA Synchronization.afterCompletion() should be closed first?
Based on the persistence specification:
7.9.1 Container Responsibilities:
After the JTA transaction has completed (either by transaction commit or rollback), The container closes the entity manager by calling EntityManager.close.
I am using DataNucleus (DN) 3.2 as a Persistence provider, and DN expects the Transaction afterCompletion() to be triggered BEFORE the EntityManager.close(). It seems that the opposite is triggered by JBoss. So I wonder if both are correct or if one should be called before another based on either JTA or Persistence JSRs?
Based on the thread dump, arjuna calls first:
at org.datanucleus.api.jpa.JPAEntityManager.close(JPAEntityManager.java:194)
at org.jboss.as.jpa.transaction.TransactionUtil$SessionSynchronization.afterCompletion(TransactionUtil.java:193)
(EntityManager.close() is called first)
Then JTA after completion:
at org.datanucleus.TransactionImpl.internalPostCommit(TransactionImpl.java:563)
at org.datanucleus.JTATransactionImpl.afterCompletion(JTATransactionImpl.java:429)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:96)
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/794692#794692]
Start a new discussion in JBoss Transactions Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2041]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130128/515857ee/attachment.html
More information about the jboss-dev-forums
mailing list