Source:
private ExecutedBatch internalBatchExecute() { if (!getBinding().isEmpty()) { add(); } if (bindings.isEmpty()) { throw new IllegalStateException("No batch parts to execute"); } String renderedSql = getConfig(SqlStatements.class) .getTemplateEngine() .render(getSql(), getContext()); getContext().setRenderedSql(renderedSql); ParsedSql parsedSql = getConfig(SqlStatements.class) .getSqlParser() .parse(renderedSql, getContext()); String sql = parsedSql.getSql(); ParsedParameters parsedParameters = parsedSql.getParameters(); getContext().setParsedSql(parsedSql); try { final PreparedStatement stmt; try { StatementBuilder statementBuilder = getHandle().getStatementBuilder(); Connection connection = getHandle().getConnection(); stmt = statementBuilder.create(connection, sql, getContext()); addCleanable(() -> statementBuilder.close(connection, sql, stmt)); } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } beforeBinding(stmt); try { for (Binding binding : bindings) { getContext().setBinding(binding); ArgumentBinder.bind(parsedParameters, binding, stmt, getContext()); stmt.addBatch(); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Exception while binding parameters", e, getContext()); } beforeExecution(stmt); SqlLogger sqlLogger = getConfig(SqlStatements.class).getSqlLogger(); try { getContext().setExecutionMoment(Instant.now()); sqlLogger.logBeforeExecution(getContext()); final int[] rs = stmt.executeBatch(); getContext().setCompletionMoment(Instant.now()); sqlLogger.logAfterExecution(getContext()); LOG.trace("Prepared batch of parts executed in {}ms", bindings.size(), getContext().getElapsedTime(ChronoUnit.MILLIS), parsedSql); afterExecution(stmt); getContext().setBinding(new Binding()); return new ExecutedBatch(stmt, rs); } catch (SQLException e) { getContext().setExceptionMoment(Instant.now()); sqlLogger.logException(getContext(), e); throw new UnableToExecuteStatementException(Batch.mungeBatchException(e), getContext()); } } finally { bindings.clear(); } }

Target:
private ExecutedBatch internalBatchExecute() { if (!getBinding().isEmpty()) { add(); } if (bindings.isEmpty()) { throw new IllegalStateException("No batch parts to execute"); } String renderedSql = getConfig(SqlStatements.class) .getTemplateEngine() .render(getSql(), getContext()); getContext().setRenderedSql(renderedSql); ParsedSql parsedSql = getConfig(SqlStatements.class) .getSqlParser() .parse(renderedSql, getContext()); String sql = parsedSql.getSql(); ParsedParameters parsedParameters = parsedSql.getParameters(); getContext().setParsedSql(parsedSql); try { final PreparedStatement stmt; try { StatementBuilder statementBuilder = getHandle().getStatementBuilder(); Connection connection = getHandle().getConnection(); stmt = statementBuilder.create(connection, sql, getContext()); addCleanable(() -> statementBuilder.close(connection, sql, stmt)); } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } beforeBinding(stmt); try { for (Binding binding : bindings) { getContext().setBinding(binding); ArgumentBinder.bind(parsedParameters, binding, stmt, getContext()); stmt.addBatch(); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Exception while binding parameters", e, getContext()); } beforeExecution(stmt); try { final int[] rs = getConfig(SqlStatements.class).getSqlLogger().wrap(stmt::executeBatch, getContext()); afterExecution(stmt); getContext().setBinding(new Binding()); return new ExecutedBatch(stmt, rs); } catch (SQLException e) { throw new UnableToExecuteStatementException(Batch.mungeBatchException(e), getContext()); } } finally { bindings.clear(); } }