I'm using iBatis SqlMapClientDaoSupport for my DAO.
Even though i'm executing multiple updates within the batch, iBatis is internally doing a 'executeBatch' at the end of the first update. After this all other updates are executed without batch.Code:public void batchInsertCustomer( final List customerList ) { getSqlMapClientTemplate().execute(new SqlMapClientCallback() { public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { executor.startBatch(); for (int i = 0; i < customerList.size(); i++) { executor.update("insertCustomerWithoutKey", customerList.get(i)); } int updCount = executor.executeBatch(); return null; } }); }
iBatis is auto starting a transaction inside the update method and the end of the update it tries to commit the transaction....Since a batch is open, it executes the batch and also closes the batch. 'autostart' of the transaction seems to be the culprit.
After looking though iBatis mailing lists, i found some references to startTransaction() call before startBatch(). Is this required ? And how do i do this with Spring SqlMapClientDaoSupport ?
I'm already using the DataSourceTransactionManager and the transaction is active.
Thanks for your help.
Ram.


Reply With Quote