Top Description Fields Constructors Methods
org.springframework.jdbc.core.support

public abstract Class AbstractInterruptibleBatchPreparedStatementSetter

extends Object
implements InterruptibleBatchPreparedStatementSetter
Class Inheritance
All Implemented Interfaces
org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter, org.springframework.jdbc.core.BatchPreparedStatementSetter
Imports
java.sql.PreparedStatement, .SQLException, org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter

Abstract implementation of the InterruptibleBatchPreparedStatementSetter interface, combining the check for available values and setting of those into a single callback method setValuesIfAvailable.
Author
Juergen Hoeller
Since
2.0
See Also
setValuesIfAvailable

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
getBatchSize()

Implements org.springframework.jdbc.core.BatchPreparedStatementSetter.getBatchSize.

This implementation returns Integer.MAX_VALUE.

public final boolean
isBatchExhausted(int
index of the statement we're issuing in the batch, starting from 0
i
)

Implements org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter.isBatchExhausted.

This implementation return this instance's current exhaustion flag.

public final void
setValues(PreparedStatement
the PreparedStatement to invoke setter methods on
ps
,
int
index of the statement we're issuing in the batch, starting from 0
i
)

Implements org.springframework.jdbc.core.BatchPreparedStatementSetter.setValues.

This implementation calls setValuesIfAvailable and sets this instance's exhaustion flag accordingly.

protected abstract boolean

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)
setValuesIfAvailable
(PreparedStatement
the PreparedStatement we'll invoke setter methods on
ps
,
int
index of the statement we're issuing in the batch, starting from 0
i
)

Check for available values and set them on the given PreparedStatement.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exhaustedback to summary
private boolean exhausted

Constructor Detail

AbstractInterruptibleBatchPreparedStatementSetterback to summary
public AbstractInterruptibleBatchPreparedStatementSetter()

Method Detail

getBatchSizeback to summary
public int getBatchSize()

Implements org.springframework.jdbc.core.BatchPreparedStatementSetter.getBatchSize.

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

Returns:int

Doc from org.springframework.jdbc.core.BatchPreparedStatementSetter.getBatchSize.

the number of statements in the batch

Annotations
@Override
isBatchExhaustedback to summary
public final boolean isBatchExhausted(int i)

Implements org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter.isBatchExhausted.

This implementation return this instance's current exhaustion flag.

Parameters
i:int

Doc from org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter.isBatchExhausted.

index of the statement we're issuing in the batch, starting from 0

Returns:boolean

Doc from org.springframework.jdbc.core.InterruptibleBatchPreparedStatementSetter.isBatchExhausted.

whether the batch is already exhausted

Annotations
@Override
setValuesback to summary
public final void setValues(PreparedStatement ps, int i) throws SQLException

Implements org.springframework.jdbc.core.BatchPreparedStatementSetter.setValues.

This implementation calls setValuesIfAvailable and sets this instance's exhaustion flag accordingly.

Parameters
ps:PreparedStatement

Doc from org.springframework.jdbc.core.BatchPreparedStatementSetter.setValues.

the PreparedStatement to invoke setter methods on

i:int

Doc from org.springframework.jdbc.core.BatchPreparedStatementSetter.setValues.

index of the statement we're issuing in the batch, starting from 0

Annotations
@Override
Exceptions
SQLException:

Doc from org.springframework.jdbc.core.BatchPreparedStatementSetter.setValues.

if an SQLException is encountered (i.e. there is no need to catch SQLException)

setValuesIfAvailableback to summary
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

the PreparedStatement we'll invoke setter methods on

i:int

index of the statement we're issuing in the batch, starting from 0

Returns:boolean

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)

Exceptions
SQLException:
if an SQLException is encountered (i.e. there is no need to catch SQLException)