研究有结果了,以下是我做了一些测试得出的结论(Sybase+Weblogic+Tx Data Source):
方法一: 1、设置方法为Container-Tracnsaction,方法的trans-attribute为Required 2、几个方法调用的SP创建前先set chained on,同时SP里是可以使用Tracnsaction的 3、此方法调用的几个方法使用同一Connection,Connection的setAutoCommitCommit使用默认设置或设为false, 若设为true,则抛出异常:Cannot set auto commit to "true" when in distributed transaction
方法二: 1、设置方法为Container-Tracnsaction,方法的trans-attribute为Required 2、几个方法调用的SP创建前先set chained on,同时SP里是可以使用Tracnsaction的 3、此方法调用的几个方法使用各自的Connection,各方法Connection的setAutoCommitCommit使用默认设置; 若设为true,则抛出异常:Cannot set auto commit to "true" when in distributed transaction; 若某方法设为false,同时在EJB的方法描述里把此方法的设置方法为Container-Tracnsaction,方法的trans-attribute 为Required, 则执行到此方法时会抛出异常:SET CHAINED command not allowed within multi-statement transaction.
方法三: 1、设置方法为Container-Tracnsaction,方法的trans-attribute为Required 2、同时各方法为Container-Tracnsaction,方法的trans-attribute为Required 3、几个方法调用的SP创建前先set chained on,同时SP里是可以使用Tracnsaction的 4、此方法调用的几个方法使用各自的Connection,各方法Connection的setAutoCommitCommit使用默认设置; 若设为true,则抛出异常:Cannot set auto commit to "true" when in distributed transaction; 若设为false,抛出异常:SET CHAINED command not allowed within multi-statement transaction.

|