Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
http://groups.google.com/group/kundera-discuss/subscribe
Apache License 2.0
903 stars 233 forks source link

Kundera and JTA with Atomikos/Application Server? #369

Closed subes closed 11 years ago

subes commented 11 years ago

Hi,

I've seen KunderaJTAUserTransaction and some code that ensures that "java:comp/UserTransaction" is bound to that implementation via JNDI.

Since Atomikos specifies its own J2eeUserTransaction, I wonder if it is possible to let kundera participate in JTA-Transactions managed by Atomikos? This would also count the same when trying to let kundera participate in JTA transactions managed by an application server like glassfish.

For me it seems KunderaJTAUserTransaction is supposed to only provide a UserTransaction implementation exclusively to manage kundera itself and for spring to be able to integrate its @Transactional support with that JTA implementation of kundera. But as I see it now, XA and having kundera participate in distributed transactions between multiple resources does not seem to be possible?

subes commented 11 years ago

I guess Kundera would need to implement some XAResources to support this.

Another question I have is: does the KunderaJTAUserTransaction properly handle two-phase-commit on kunderas underlying persistence units? So for example transactions that span across rdbms and cassandra at the same time?

If that is the case, maybe it would be possible to write a XAResource wrapper around KunderaJTAUserTransaction to let it participate in higher order transactions managed by atomikos/application server? Seems like this would be some sort of "nested two phase commit". I don't know if this is even supported by jta?

mevivs commented 11 years ago
 does the KunderaJTAUserTransaction properly handle two-phase-commit on kunderas underlying persistence units? 
So for example transactions that span across rdbms and cassandra at the same time?

Kundera ensures atomocity across polyglot databases, em.commit(), em.rollback() would ensure same behavior for multiple databases(e.g. RDBMS,Cassandra etc).

We did try to enable existing JTA impementation such Atomikos, but they looked to very much tightly coupled with their custom implementation. Existing JTATransaction or UserTransaction implementation with atomikos doesn't provide a way for this.

For XAResources, i think it is possible and as JTATransaction Manager we should support XAResource implementation. But as said earlier we need to explore how Atomikos/JBoss app server would behave with this. AFAIK, These JTA implementation are tightly coupled with their custom and JDBCTransactions does not work properly with external implementations(Non JDBC Transactions).

-Vivek

subes commented 11 years ago

Ok, good to know. For now I went without 2PC across multiple EntityManagerFactories and rather design my code to distinguish between TransactionManagers properly when accessing different ORMs.

mevivs commented 11 years ago

Using Kundera for?

Request you to spare few minutes to fill in survey, here is the link: http://www.surveymonkey.com/s/BMB9PWG

Cheers, -Vivek

subes commented 11 years ago

done the survey, using for data access during parallellized financial backtests using hadoop; though I guess I will be waiting for MappedSuperclass support before using it fully, since my code depends on this feature.