JBoss Community

Re: How more than one XA Datasources participate in one container managed transaction ?

created by Wolf-Dieter Fink in Datasource Configuration - View the full discussion

If you use CMT the container will track which resource is involved in the transaction.

If the EJB is finished (mean that the business method return) the container will send a prepare to all XA resources and if successful a commit.

It is the responsibility of the container how to do this. AFAIK JBoss will send prepare/commit in that order the resources are got from the container( but this might change with different versions).

 

Also if you use different resources from an EJB, or a couple of EJB's, inside the same JBoss instance you do not need a JTS configuration. It will be more complex and might have performance drawbacks as it uses IIOP.

 

So a Tx is committed if you return from a method with a different Tx scope, let me shown an example:

 

Method1 (Tx.Required)

   do DB stuff

  -> M2 (Tx.NotSupported)

      Tx1 suspended

   -> M3 (Tx.Required)

        Tx2

       do DB stuff maybe different DB'S

       return

   <-  (prepare)commit Tx2

   <-

<-

(prepare)commit Tx1

 

The commits are done by the container outside your code (also outside the interceptors)

There is no configuration to control that.

Reply to this message by going to Community

Start a new discussion in Datasource Configuration at Community