OK, but presumably nowhere in the JTA spec does it state that it should be able
to function outside an EJB container, in the way that JPA does?
[EMAIL PROTECTED] on 14/11/07 01:30, wrote:
They're both part of the JTA spec.
-Patrick
On 11/13/07, Adam Hardy <[EMAIL PROTECTED]> wrote:
Patrick Linskey on 10/11/07 21:15, wrote:
Hi,
if openjpa.TransactionMode=local, we have to deal with the transactions
in the
data access layer. But this is not what I want to do - I'd like my
'non-EJB
transaction manager of choice' (currently Spring) to manage them.
There are a few different concepts at play here. One is the
transaction manager (Spring in your case). Another is the "persistence
container" (Spring can do that, or a Java EE server, but it sounds
like you're planning to create your own featherweight persistence
container (the term "lightweight" is a bit overloaded these days) that
handles transactions somewhere above the data tier. A third is your
data access code.
If you were deploying in an environment where you were using Spring
for managing the persistence unit, then the Spring transaction manager
integration would happen automatically.
Without anyone else's input on this, I'm going to look further down this
route:
providing OpenJPA with the means to get at the managed transactions /
entity
managers.
Do you know whether this is OpenJPA functionality only or if it's
specified in
the EJB JPA specification? I'd like to be able to say that I can swop
OpenJPA
for any other JPA provider with only configuration changes necessary.
The JPA spec doesn't define how a persistence provider should go about
obtaining the JTA transaction. With OpenJPA, there are a number of
configuration-based means to set this up; I would expect the same to
be the case for other persistence providers.
In OpenJPA, you can do one of the following:
1. Specify a JNDI location where the TransactionManager can be found
2. Tell OpenJPA to use the TransactionSynchronizationManager, which
should be registered at java:comp/TransactionSynchronizationRegistry
per the Java EE 5 spec
Are TransactionManager and TransactionSynchronizationManager EJB3 interfaces
from JEE?
Spring has its own version of TransactionSynchronizationManager but it's not
an
implementation of any framework interface, unfortunately.
So it looks as if I can't write use it. I'll have to look into JNDI and
java:comp/TrnasactionSynchronizationRegistry.
Adam