Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Minor Minor
Assignee: Unassigned
Reporter: nicolas
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus AccessPlatform

EE containers are supposed to close the EntityManager

Created: 19/Jan/13 04:53 PM   Updated: 01/Feb/13 07:42 AM   Resolved: 21/Jan/13 10:05 AM
Component/s: Software
Affects Version/s: 3.2.0.m1
Fix Version/s: None

Environment: JBoss 7.1.1 Final, JDK 7, windows 8 and Ubuntu 12.10, JPA, EJB 3

Forum Thread URL:,7378_offset,20
Severity: Production

 Description  « Hide
The JPA 2.0 specification section 7.9.1 states the following requirements:
7.9.1 Container Responsibilities
For the management of a transaction-scoped persistence context, if there is no EntityManager alreadyassociated with the JTA transaction:
- The container creates a new entity manager by calling EntityManagerFactory.createEntityManager when the first invocation of an entity manager with PersistenceContextType.TRANSACTION occurs within the scope of a business method executing in the JTA transaction.
- After the JTA transaction has completed (either by transaction commit or rollback), The container closes the entity manager by calling EntityManager.close. [79]
... see JPA 2.0 spec for ommitted text that is not relevant to this discussion ...
[79] The container may choose to pool EntityManagers: it instead of creating and closing in each case, it may acquire one from its pool and call clear() on it.

The following is thus wrong:

Description The JPA spec (3.11) says that a "container-managed" EntityManager should not be closed (by calling close()). Some JavaEE containers ignore this, and are non-compliant as a result but you can ignore such calls if you set this persistence property to true.
Range of Values false | true

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 21/Jan/13 10:05 AM
Refer to NUCJPA-205