aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject JTA 2 - Bug in XAJpaTemplate#txExpr using TransactionType.Supports?
Date Wed, 02 Sep 2015 23:48:00 GMT
Hey all, thanks for the great aries bundles.

I'm trying to put together a JPA+JTA setup to do XA across Eclipselink partitions for replicated
entities to begin sharding an existing application. I've worked through to an almost working
setup and I'm running into a problem that I think may be a bug.

When trying to run txExpr methods on my OSGi-exposed JpaTemplate services I get a TransactionRequired
[1] exception every time I use TransactionType.Supports. It seems to me that the logic in
XAJpaTemplate#txExpr is calling EntityManager#joinTransaction() regardless of whether there
is a current global transaction. So for situations where you just want your logic to 'support'
running within an existing global transaction, but not create a new one if one doesn't exist,
em.joinTransaction() is still being called.

I'm a bit new to XA/JTA so perhaps I'm not understanding how this should work.

Would it make sense to delegate the joining to a new method TransactionAttribute that only
calls em.joinTransaction if the current transaction is not null?

I appreciate the input on this. Thanks!

[1] Caused by: javax.persistence.TransactionRequiredException:
Exception Description: No externally managed transaction is currently active for this thread
        at org.eclipse.persistence.internal.jpa.transaction.JTATransactionWrapper.throwCheckTransactionFailedException(
        at org.eclipse.persistence.internal.jpa.transaction.JTATransactionWrapper.checkForTransaction(
        at org.eclipse.persistence.internal.jpa.transaction.JTATransactionWrapper.registerIfRequired(
        at org.eclipse.persistence.internal.jpa.EntityManagerImpl.joinTransaction(
        at ~[na:na]
        ... 20 common frames omitted

Matthew Pitts

Security Solutions Design & Automation

Wells Fargo Bank | Tel 336.608.3332 | Cell 336.202.3913 | Kernersville, NC | MAC D9693-010

View raw message