Hi,

Below is my java code, to execute a batch

this.getSqlMapClient().startBatch();
for (Subscriber subscriber : subscriberList) {
    this.getSqlMapClient().update("Subscriber_updateSubscriber",
subscriber);
}
List<BatchResult> batchResult =
this.getSqlMapClient().executeBatchDetailed();

But I found the batchResult alway is null.

Here is the source code of
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate#startBatch

public void startBatch(SessionScope session) {
    session.setInBatch(true);
}

and here is the source code of
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate#executeBatchDetailed

 public List executeBatchDetailed(SessionScope session) throws SQLException,
BatchException {
    session.setInBatch(false);
    return sqlExecutor.executeBatchDetailed(session);
  }

So, why need ‘session.setInBatch(false);’ in the mehod
executeBatchDetailed()? And is this the cause of "batchResult always is
null"?

Thanks

Joey Lv

Reply via email to