List of usage examples for org.apache.ibatis.executor.statement StatementHandler batch
void batch(Statement statement) throws SQLException;
From source file:com.luxoft.mybatis.splitter.ReusingBatchExecutor.java
License:Apache License
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); final BoundSql boundSql = handler.getBoundSql(); PreparedStatementKey key = new PreparedStatementKey(boundSql.getSql(), ms); StatementData statementData = statementsData.get(key); if (retainExecuteOrder && statementData != null && !key.equals(lastKey)) { statementData = null;// w w w . j av a2s .com executeUpTo(key, true); } if (statementData == null) { statementData = unusedStatementData.remove(key); if (statementData == null) { Connection connection = getConnection(ms.getStatementLog()); Statement stmt = handler.prepare(connection); statementData = new StatementData(stmt); } statementsData.put(key, statementData); } lastKey = key; statementData.addParameterObject(parameterObject); handler.parameterize(statementData.getStatement()); handler.batch(statementData.getStatement()); return BATCH_UPDATE_RETURN_VALUE; }