Example usage for org.springframework.jdbc.core InterruptibleBatchPreparedStatementSetter setValues

List of usage examples for org.springframework.jdbc.core InterruptibleBatchPreparedStatementSetter setValues

Introduction

In this page you can find the example usage for org.springframework.jdbc.core InterruptibleBatchPreparedStatementSetter setValues.

Prototype

void setValues(PreparedStatement ps, int i) throws SQLException;

Source Link

Document

Set parameter values on the given PreparedStatement.

Usage

From source file:com.github.ferstl.spring.jdbc.oracle.BatchingPreparedStatementCallback.java

private void executeUpdate(OraclePreparedStatement ops, InterruptibleBatchPreparedStatementSetter ipss,
        List<Integer> rowCounts) throws SQLException {

    ops.setExecuteBatch(this.sendBatchSize);
    int i = 0;/* w ww  .  j  a v a  2 s .  com*/
    while (i < ipss.getBatchSize()) {
        ipss.setValues(ops, i);
        if (ipss.isBatchExhausted(i)) {
            break;
        }
        rowCounts.add(ops.executeUpdate());
        i++;
    }

    if (i > 0 && i % this.sendBatchSize != 0) {
        rowCounts.set(rowCounts.size() - 1, ops.sendBatch());
    }

}