Some postings of iBatis makes it seem that if you want to give the container
full control of how commits are handled (and not iBatis), then you have to
do:
<transactionManager type="EXTERNAL" commitRequired="true">
<property name="DefaultAutoCommit" value="false"/>
<property name="SetAutoCommitAllowed" value="false"/>
But when you look into the ExternalTransaction class, it appears none of
these settings matter, because it has no implementation for commit or
rollback:
public void commit() throws SQLException, TransactionException {
}
public void rollback() throws SQLException, TransactionException {
}
And you can see that the only place the isCommitRequired is called (besides
its loading from the configuration field that lives in SessionScope) is in
TransactionManager:
public void commit(SessionScope session) throws SQLException,
TransactionException {
Transaction trans = session.getTransaction();
TransactionState state = session.getTransactionState();
if (state == TransactionState.STATE_USER_PROVIDED) {
throw new TransactionException("TransactionManager could not commit.
" +
"A user provided connection is currently being used by this
session. " +
"You must call the commit() method of the Connection directly. "
+
"The calling .setUserConnection (null) will clear the user
provided transaction.");
} else if (state != TransactionState.STATE_STARTED && state !=
TransactionState.STATE_COMMITTED ) {
throw new TransactionException("TransactionManager could not commit.
No transaction is started.");
}
if (session.isCommitRequired() || forceCommit) {
trans.commit();
session.setCommitRequired(false);
}
session.setTransactionState(TransactionState.STATE_COMMITTED);
}
So if you use an External transactionManager, it appears that this
trans.commit() call does nothing. Unless I am not reading this wrong.
--
View this message in context:
http://www.nabble.com/commitRequired-%2C-DefaultAutoCommit-%2C-SetAutoCommitAllowed--tf1856695.html#a5071612
Sent from the iBATIS - User - Java forum at Nabble.com.