接口 InterruptibleBatchPreparedStatementSetter
- 所有超级接口:
BatchPreparedStatementSetter
public interface InterruptibleBatchPreparedStatementSetter extends BatchPreparedStatementSetter
Extension of theBatchPreparedStatementSetter
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(int)
method is called after each call toBatchPreparedStatementSetter.setValues(java.sql.PreparedStatement, int)
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 tosetValues
.Consider extending the
AbstractInterruptibleBatchPreparedStatementSetter
base class instead of implementing this interface directly, using a singlesetValuesIfAvailable
callback method that checks for available values and sets them, returning whether values have actually been provided.- 从以下版本开始:
- 2.0
- 作者:
- Thomas Risberg, Juergen Hoeller
- 另请参阅:
JdbcTemplate.batchUpdate(String, BatchPreparedStatementSetter)
,AbstractInterruptibleBatchPreparedStatementSetter
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 boolean
isBatchExhausted(int i)
Return whether the batch is complete, that is, whether there were no additional values added during the lastsetValues
call.从接口继承的方法 org.springframework.jdbc.core.BatchPreparedStatementSetter
getBatchSize, setValues
方法详细资料
isBatchExhausted
boolean isBatchExhausted(int i)
Return whether the batch is complete, that is, whether there were no additional values added during the lastsetValues
call.NOTE: If this method returns
true
, any parameters that might have been set during the lastsetValues
call will be ignored! Make sure that you set a corresponding internal flag if you detect exhaustion at the beginning of yoursetValues
implementation, letting this method returntrue
based on the flag.- 参数:
i
- index of the statement we're issuing in the batch, starting from 0- 返回:
- whether the batch is already exhausted
- 另请参阅:
BatchPreparedStatementSetter.setValues(java.sql.PreparedStatement, int)
,AbstractInterruptibleBatchPreparedStatementSetter.setValuesIfAvailable(java.sql.PreparedStatement, int)