Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jpa-dev] Can container EntityManagerFactory instances be RESOURCE_LOCAL?

Container managed persistence contexts (those injected with @PersistenceContext) must be JTA persistence units.  Application managed persistence contexts (those injected with @PersistenceUnit) can be either JTA or RESOURCE_LOCAL.  An application server's runtime is going to use PersistenceProvider.createContainerEntityManagerFactory() to create an EntityManagerFactory for both cases under the hood.

On Fri, Apr 26, 2019 at 6:27 PM Laird Nelson <ljnelson@xxxxxxxxx> wrote:
The specification says, in section 7.5, unambiguously IMHO:

An entity manager whose underlying transactions are controlled through JTA is termed a JTA entity manager.
[...]
A container-managed entity manager must be a JTA entity manager. 

Note the last sentence.

Now, the javadocs for PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map) do not indicate that it is an illegal state for a PersistenceUnitInfo to be supplied whose associated transaction type is PersistenceUnitTransactionType.RESOURCE_LOCAL.  But shouldn't it be?

Am I correct in assuming that a PersistenceUnitInfo instance whose getTransactionType() method returns PersistenceUnitTransactionType.RESOURCE_LOCAL must not be supplied to PersistenceProvider#crateContainerEntityManagerFactory(PersistenceUnitInfo, Map), even though the javadocs do not indicate its illegality?

Thanks,
Best,
Laird

_______________________________________________
jpa-dev mailing list
jpa-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jpa-dev

Back to the top