当ExecutorType为Batch
时,更新操作返回的update counts会丢失,返回的值为-2127485646,原因是BatchExecutor
中的doUpdate
方法:
public static final int BATCH_UPDATE_RETURN_VALUE = Integer.MIN_VALUE + 1002;
public BatchExecutor(Configuration configuration, Transaction transaction) {
super(configuration, transaction);
}
@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
final Configuration configuration = ms.getConfiguration();
final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null)