jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: improve how persistence providers learn of the JTA transaction manager to be used...

From: Adam Bien <abien_at_adam-bien.com>
Date: Mon, 7 Nov 2011 22:26:58 +0100

You can inject TransactionSynchronizationRegistry with @Resource. It works perfectly on all major appservers. Lookup works as well...
On 28.10.2011, at 19:57, Linda DeMichiel wrote:

> The Java EE platform requires that the TransactionSynchronizationRegistry be made
> available through JNDI (or by injection). Doesn't this work? See section EE.5.11.
>
> -Linda
>
> On 10/28/2011 6:33 AM, Scott Marlow wrote:
>> Recently, I have been spending a lot of time on the JBoss AS JPA container and its integration with persistence
>> providers using the JPA SPIs. I think we have some low hanging fruit to be had, in standardizing how the persistence
>> providers obtain a JTA transaction manager.
>>
>> I've looked at (mostly four) different persistence providers and how they have application server vendor (often version)
>> specific integration for obtaining either the JTA TransactionManager or TransactionSynchronizationRegistry.
>>
>> To improve how persistence providers integrate with containers, I think we should introduce properties for the container
>> to pass a TM/TSR reference to the provider. This will help reduce the amount of application server vendor specific code,
>> needed by the different persistence providers.
>>
>> Perhaps the properties could be:
>>
>> javax.persistence.transactionmanager - JNDI name of JTA Transaction Manager or instance of JTA Transaction Manager
>>
>> javax.persistence.transactionsynchronization - JNDI name of TransactionSynchronizationRegistry or instance of
>> TransactionSynchronizationRegistry.
>>
>> The idea being that providers should expect either a TM/TSR to be passed directly or to use a JNDI lookup name (so
>> providers could work with EE servers that don't have a single TSR/TM to pass in but perhaps have several instances to
>> choose from).
>>
>> What do you think?
>>
>> Scott