0 Replies Latest reply on Sep 3, 2010 2:03 AM by Thunder Lei

    JBoss 5.0 behavior of non-tx-datasource committed or NOT?

    Thunder Lei Newbie

      Hi there,


      When I look at the JBoss documents, there is a definition for non-tx-datasource, it said:" This element is used to specify the (org.jboss.resource.connectionmanager)NoTxConnectionManager service configuration. NoTxConnectionManager is a JCA connection manager with no transaction support. ".


      As my understanding to this definition, any changes made by using non-tx-datasource should NOT be committed into the underlying database, but according my investigation, that's NOT it. If non-tx-datasource works with xa-datasource, the both will commit or rollback.


      Could you guys pls give some clarification on this?


      What I did to verify non-tx-datasource behavior is: I have two session beans, ReadOnlyBean and XABean, which in turn refer to two JPA entity managers, and the entity managers refer to two datasouce, one is non-tx-datasource and xa-datasource.

      These two datasources are connecting different databases.

      I double checked the JDBC drivers used by these two datasources, one is xa and another is non xa.


      Then I have the third session bean FacadeBean. In one method of  this facade bean, I call ReadOnlyBean and XABean to update database.

      All the methods are given the transaction attribute as @TransactionAttribute(TransactionAttributeType.REQUIRED).

      I call ReadOnlyBean first, then call the XABean.


      If I throw EJBException in the XABean, seems both transactions are rolled back.

      If there is no EJBException, both changes are committed into underlying database.


      any comments are appreciated.