J2EE JTA and Database Transaction Research

zhaozj2021-02-16  45

The research has the result. The following is the conclusion I have made some tests (Sybase WebLogic TX Data Source):

Method 1: 1, the setting method is the trans-attribute for the Container-TracnsAction, the method of the method is required, and several methods call the SP creation first set chained on, and the SP can use TracnsAction 3, this method calls several methods Use the same connection, connection setAutoCommitCommit uses the default settings or set to false, if set to true, throw an exception: cannot set auto commit to "true" when in distributed Transaction

Method 2: 1. Setting the method for the Container-TracnsAction, the trans-attribute of the method is required2, and several methods calling the SP creation first set chained on, and the SP is 3, which can use TracnsAction 3, this method calls several methods Using the respective connection, each method connection setAutocommitCommit uses the default settings; if set to true, throw an exception: cannot set auto commit to "true" when in distributed transaction; if the method is set to FALSE, the method of EJB is described in EJB The setting method of this method is Container-TracnsAction, the trans-attribute of the method is Required, and the exception is thrown when this method is performed: set chained command not allowed Withnin Multi-Statement Transaction.

Method 3: 1. Setting the method for the Container-TracnsAction, the trans-attribute of the method is Required2, and each method is the Container-TracnsAction, the trans-attribute of the method is required, and several methods call the SP creation SET CHAINED ON, The SP can be used in TracNSAction 4. Several methods called by this method use the respective connection, each method connection setAutocommitCommit uses the default settings; if set to true, throw an exception: cannot set auto commit to "true" when "WHEN in Distributed Transaction; if you set it to false, throw an exception: set chained command not allowed within multi-statement transaction.

转载请注明原文地址:https://www.9cbs.com/read-25916.html

New Post(0)