Top Description Methods
org.springframework.jdbc.core

public Interface InterruptibleBatchPreparedStatementSetter

extends BatchPreparedStatementSetter
Known Direct Implementers
org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter

Extension of the BatchPreparedStatementSetter interface, adding a batch exhaustion check.

This interface allows you to signal the end of a batch rather than having to determine the exact batch size upfront. Batch size is still being honored but it is now the maximum size of the batch.

The isBatchExhausted method is called after each call to setValues to determine whether there were some values added, or if the batch was determined to be complete and no additional values were provided during the last call to setValues.

Consider extending the org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter base class instead of implementing this interface directly, using a single setValuesIfAvailable callback method that checks for available values and sets them, returning whether values have actually been provided.

Authors
Thomas Risberg, Juergen Hoeller
Since
2.0
See Also
JdbcTemplate#batchUpdate(String, BatchPreparedStatementSetter), org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the batch is already exhausted
isBatchExhausted
(int
index of the statement we're issuing in the batch, starting from 0
i
)

Return whether the batch is complete, that is, whether there were no additional values added during the last setValues call.

Inherited from org.springframework.jdbc.core.BatchPreparedStatementSetter:
getBatchSizesetValues

Method Detail

isBatchExhaustedback to summary
public boolean isBatchExhausted(int i)

Return whether the batch is complete, that is, whether there were no additional values added during the last setValues call.

Note

If this method returns true, any parameters that might have been set during the last setValues call will be ignored! Make sure that you set a corresponding internal flag if you detect exhaustion at the beginning of your setValues implementation, letting this method return true based on the flag.

Parameters
i:int

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

Returns:boolean

whether the batch is already exhausted

See Also
setValues, org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter#setValuesIfAvailable