Why not use BaseDaoiBATIS class from the Spring framework
and specify transaction levels from xml file to do auto commit??
 
So no manual code is required to commit
 
Makes life easier
 
Sam
----- Original Message -----
Sent: Friday, July 07, 2006 11:03 PM
Subject: autoCommit

Hi,
 
I have found in com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction class, init method, the following lines of code:
 
// AutoCommit
if (connection.getAutoCommit()) {
    connection.setAutoCommit(false);
}
 
I do not understand why should it be set to "false" by default, even I am running simple SELECT statements !
 
Using Websphere as application server, I am receiving the following warning messages after each database call:
[7/7/06 13:40:41:111 EEST] 00000026 LocalTranCoor W   WLTC0032W: One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment.
 
and sometimes errors like Websphere cannot cleanup the connection because it seems to be in a transaction !!!
 
One solution found on Internet is to setup in sql-map-config:
<transactionManager type="JDBC" commitRequired="true">
 
and iBatis will perform a commit() at the end (see SqlMapConfigParser and TransactionManager classes):
 
txManager.setForceCommit("true".equals(attributes.getProperty("commitRequired")));
...
if (session.isCommitRequired() || forceCommit) {
    trans.commit();
    session.setCommitRequired(false);
}
 
My question is: why should I use "commitRequired=true" even if I am executing a simple SELECT statement ? I feel that this "commitRequired=true" is a workaround to a problem generated by wrong initialization of the JdbcTransaction!
 
Thank you,
Cornel

Reply via email to