Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.core.support
Class AbstractInterruptibleBatchPreparedStatementSetter

    java.lang.Object
      org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter

All Implemented Interfaces:
  BatchPreparedStatementSetter, InterruptibleBatchPreparedStatementSetter

    public abstract class AbstractInterruptibleBatchPreparedStatementSetter

extends Object
implements InterruptibleBatchPreparedStatementSetter

Abstract implementation of the `InterruptibleBatchPreparedStatementSetter` interface, combining the check for available values and setting of those into a single callback method `setValuesIfAvailable(java.sql.PreparedStatement, int)`.

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `setValuesIfAvailable(java.sql.PreparedStatement, int)`

Constructor Summary
`AbstractInterruptibleBatchPreparedStatementSetter()`

Method Summary
`int` | `getBatchSize()` This implementation returns `Integer.MAX_VALUE`.
`boolean` | `isBatchExhausted(int i)` This implementation return this instance's current exhaustion flag.
`void` | `setValues(PreparedStatement ps, int i)` This implementation calls `setValuesIfAvailable(java.sql.PreparedStatement, int)` and sets this instance's exhaustion flag accordingly.
`protected abstract boolean` | `setValuesIfAvailable(PreparedStatement ps, int i)` Check for available values and set them on the given PreparedStatement.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractInterruptibleBatchPreparedStatementSetter

    public AbstractInterruptibleBatchPreparedStatementSetter()

Method Detail

### setValues

    public final void setValues(PreparedStatement ps,
                                int i)
                         throws SQLException

  This implementation calls `setValuesIfAvailable(java.sql.PreparedStatement, int)` and sets this instance's exhaustion flag accordingly.

  Specified by:
    `setValues` in interface `BatchPreparedStatementSetter`
  Parameters:
    `ps` - the PreparedStatement to invoke setter methods on
    `i` - index of the statement we're issuing in the batch, starting from 0
  Throws:
    `SQLException` - if a SQLException is encountered (i.e. there is no need to catch SQLException)

### isBatchExhausted

    public final boolean isBatchExhausted(int i)

  This implementation return this instance's current exhaustion flag.

  Specified by:
    `isBatchExhausted` in interface `InterruptibleBatchPreparedStatementSetter`
  Parameters:
    `i` - index of the statement we're issuing in the batch, starting from 0
  Returns:
    whether the batch is already exhausted
  See Also:
    `BatchPreparedStatementSetter.setValues(java.sql.PreparedStatement, int)`, `setValuesIfAvailable(java.sql.PreparedStatement, int)`

### getBatchSize

    public int getBatchSize()

  This implementation returns `Integer.MAX_VALUE`. Can be overridden in subclasses to lower the maximum batch size.

  Specified by:
    `getBatchSize` in interface `BatchPreparedStatementSetter`
  Returns:
    the number of statements in the batch

### setValuesIfAvailable

    protected abstract boolean setValuesIfAvailable(PreparedStatement ps,
                                                    int i)
                                             throws SQLException

  Check for available values and set them on the given PreparedStatement. If no values are available anymore, return `false`.

  Parameters:
    `ps` - PreparedStatement we'll invoke setter methods on
    `i` - index of the statement we're issuing in the batch, starting from 0
  Returns:
    whether there were values to apply (that is, whether the applied parameters should be added to the batch and this method should be called for a further iteration)
  Throws:
    `SQLException` - if a SQLException is encountered (i.e. there is no need to catch SQLException)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.