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