jbossas/jboss-as — pull request #1028 by scottmarlow (2012-01-05 16:24:31+00:00)
Title: AS7-2899 JPA 2.0 section 3.8.6 (tx scoped pc in non-tx should detach entities loaded by query)

Also, close the XPC only if its still open (if EMF already closed, EM is also closed).
Also, when closing the persistence context after a TX ends, use a TSR sync instead of TX (interposed syncs run after user code completes).