First version of JTA in DODS created transactions that implemented javax.transaction.xa.XAResource interface. This interface is a java mapping of the industry standard XA interface based on the X/Open CAE Specification (Distributed Transaction Processing: The XA Specification).
This solution brought hierachy problems between DODS and XADataSource connections. Instead of this implementation, new version of JTA in DODS created transactions that implemented javax.transaction.Synchronization interface. This implementation is explained in the next section.
To use JTA API Transaction implementation in DODS (XATransaction) first step is to set TransactionFactory parameter in app. configuration file to "org.enhydra.dods.xa.XATransactionFactory" :
DatabaseManager.DB.<LdbName>.TransactionFactory = "org.enhydra.dods.xa.XATransactionFactory"
This parameter tell DODS to create (JTA) XATransaction instead of StandardDBTransaction. And then in same file set additional properties requested by XATransactionFactory:
1. XADefaultTimeout is timeout of distributed transation.
DatabaseManager.DB.<LdbName>.XADefaultTimeout = 60
2. XAUsageCase is parameter that tell DODS how to behave when application performe commit(),rollback() or release() against XATransaction. XATransaction are always controlled by (JTA) UserTransaction and should never explicit perform any of this operations.
Values are : 0(INGORE), 1(WARN), 2(WARN_WITH_TRACE), 3(THROW_EXCEPTION), 4(THROW_ERROR).
DatabaseManager.DB.<LdbName>.XAUsageCase=0
3. Factory class of Wrapped transaction (transaction encapsulated inside XATransaction, default = StandardDBTransactionFactory)
DatabaseManager.DB.<LdbName>.XAWrappedTransImplFactory = "com.lutris.appserver.server.sql.standard.StandardDBTransactionFactory"
4. JNDI lookup name of (JTA) UserTransaction object default = "java:comp/UserTransaction"
DatabaseManager.DB.<LdbName>.XaUserTransactionLookupName = "java:comp/UserTransaction"
5. JNDI lookup name of (JTA) TransactionManager object
DatabaseManager.DB.<LdbName>.XATransactionManagerLookupName = "java:comp/UserTransaction"
To force DODS to create (JTA) UserTransaction instead (JTA) XATransaction set TransactionFactory parameter to "XAUserTransactionFactory". Eg:
DatabaseManager.DB.<LdbName>.TransactionFactory = "org.enhydra.dods.xa.XAUserTransactionFactory
In case of using XAUserTransactionFactory there are also one additional parameter named 'JTASupport', this parameter tell DODS how to handle requests for new Transactions in different JTA environment. Eg:
DatabaseManager.DB.<LdbName>.JTASupport = MANDATORY
Parameter values are: MANDATORY, REQUIRED (by default), REQUIRES_NEW, SUPPORTS, NOT_SUPPORTED, NEVER.
NOT_SUPPORTED: If the DODS transaction factory is called within a user transaction scope, this user transaction is suspended during the time of the new transaction execution (transaction factory return simple DODS transaction object defined by XAWrappedTransImplFactory parameter).
REQUIRED: If the DODS transaction factory is called within a user transaction, the transaction is created in the scope of this user transaction (transactions factory returns instance of org.enhydra.dods.xa.XATransaction class), else, a new user transaction is started (transactions factory returns instance of org.enhydra.dods.xa.XAUserTransaction class).
REQUIRES_NEW: DODS transaction factory will always create new user transaction. If the transaction constructor is called within existing user transaction, this transaction is suspended before the new one is started and resumed when the new transaction has completed. (transactions factory returns instance of org.enhydra.dods.xa.XAUserTransaction class).
MANDATORY: The DODS transaction factory should always be called within the scope of a user transaction (transactions factory returns instance of org.enhydra.dods.xa.XATransaction class), else the DODS will throw exception.
SUPPORTS: DODS transaction factory is invoked within the caller transaction scope (transactions factory returns instance of org.enhydra.dods.xa.XATransaction class), if the caller does not have an associated user transaction , DODS transaction is invoked without a transaction scope (transaction factory return simple DODS transaction object defined by XAWrappedTransImplFactory parameter).
NEVER: The client is required to call the DODS transaction factory without any transaction context (transaction factory return simple DODS transaction object defined by XAWrappedTransImplFactory parameter), if it is not the case, a exception is thrown by the DODS.
All other parameters (1-5) have same meaning like in case of XATransaction. Detail explanation of Java Transaction API (JTA) see reference documentation from Sun Microsystems Inc. site.
All parameters described in this chapter can also be added on 'DatabaseManager' level.