ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joey Lv <mrl...@gmail.com>
Subject Question about the executeBatch......
Date Wed, 22 Apr 2009 05:40:34 GMT
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

Mime
View raw message