Announcement Announcement Module
Collapse
No announcement yet.
Use JTA transaction manager outside container Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use JTA transaction manager outside container

    We have a use case:
    - We need to write a batch job to process on Datasource A (DsA)
    - Our SB job repository is also on DsB.

    In this case, I think we need a JTA transaction manager but do not want to move the batch job run inside container solely due to this reason. Is there any JTA provider that your team tested works fine on standalone JVM?

  • #2
    Atomikos is supposed to be the best available.

    You could also consider making your business processing idempotent (check for data already processed before updating / inserting, or use a where cluase in updates). Then you can use TransactionAwareDataSourceProxy for the business DataSource and a normal DataSource/tx manager for the Batch schema (the worst that can happen in this case is that the business database goes down in between the batch commit and the business commit).

    Comment


    • #3
      Thanks for the suggestion on a good JTA provider.

      Just to clarify my understanding a bit. What you mean is that if we use TransactionAwareDataSourceProxy, we can join up two or more datasources (even non-XA) in ONE transaction manager. The 'commit' call will only be issued to all registered datasource when the transaction is commited, so as it for rollack case.

      If my understanding is correct, another potential problem is that if DsA.commit success but DsB.commit fail, DsA will not be able to rollback. Am I right?

      Comment


      • #4
        If my understanding is correct, another potential problem is that if DsA.commit success but DsB.commit fail, DsA will not be able to rollback. Am I right?
        That's not another problem, it's the same one I described. But otherwise you are right.

        Comment


        • #5
          What database are you using? I ran into the same issue recently at a client that was running Oracle and used the built in Oracle features (I believe its called DBSync, could also be called DBLink) to handle it without JTA. Essentially, Oracle will handle the global transactions internally, so you can continue to use what look like local transactions to you. I'm not sure if other database providers have a similar feature or not.

          Comment

          Working...
          X