类 StoredProcedureItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.database.builder.StoredProcedureItemReaderBuilder<T>
public class StoredProcedureItemReaderBuilder<T> extends java.lang.Object
A fluent builder API for the configuration of aStoredProcedureItemReader
.- 从以下版本开始:
- 4.0.0
- 作者:
- Michael Minella, Mahmoud Ben Hassine
- 另请参阅:
StoredProcedureItemReader
字段概要
字段 修饰符和类型 字段 说明 static int
VALUE_NOT_SET
构造器概要
构造器 构造器 说明 StoredProcedureItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 StoredProcedureItemReader<T>
build()
Validates configuration and builds a new reader instanceStoredProcedureItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.StoredProcedureItemReaderBuilder<T>
dataSource(javax.sql.DataSource dataSource)
TheDataSource
to read fromStoredProcedureItemReaderBuilder<T>
driverSupportsAbsolute(boolean driverSupportsAbsolute)
Indicates if the JDBC driver supports setting the absolute row on theResultSet
.StoredProcedureItemReaderBuilder<T>
fetchSize(int fetchSize)
A hint to the driver as to how many rows to return with each fetch.StoredProcedureItemReaderBuilder<T>
function()
Indicates the stored procedure is a functionStoredProcedureItemReaderBuilder<T>
ignoreWarnings(boolean ignoreWarnings)
Indicates if SQL warnings should be ignored or if an exception should be thrown.StoredProcedureItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.StoredProcedureItemReaderBuilder<T>
maxRows(int maxRows)
The max number of rows theResultSet
can containStoredProcedureItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.StoredProcedureItemReaderBuilder<T>
parameters(org.springframework.jdbc.core.SqlParameter[] parameters)
SQL parameters to be set when executing the stored procedureStoredProcedureItemReaderBuilder<T>
preparedStatementSetter(org.springframework.jdbc.core.PreparedStatementSetter preparedStatementSetter)
Configures the providedPreparedStatementSetter
to be used to populate any arguments in the SQL query to be executed for the reader.StoredProcedureItemReaderBuilder<T>
procedureName(java.lang.String procedureName)
The name of the stored procedure to executeStoredProcedureItemReaderBuilder<T>
queryTimeout(int queryTimeout)
The time in milliseconds for the query to timeoutStoredProcedureItemReaderBuilder<T>
refCursorPosition(int refCursorPosition)
The parameter position of the REF CURSOR.StoredProcedureItemReaderBuilder<T>
rowMapper(org.springframework.jdbc.core.RowMapper<T> rowMapper)
TheRowMapper
used to map the results of the cursor to each item.StoredProcedureItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.StoredProcedureItemReaderBuilder<T>
useSharedExtendedConnection(boolean useSharedExtendedConnection)
Indicates that the connection used for the cursor is being used by all other processing, therefor part of the same transaction.StoredProcedureItemReaderBuilder<T>
verifyCursorPosition(boolean verifyCursorPosition)
Indicates if the reader should verify the current position of theResultSet
after being passed to theRowMapper
.
字段详细资料
VALUE_NOT_SET
public static final int VALUE_NOT_SET
- 另请参阅:
- 常量字段值
构造器详细资料
StoredProcedureItemReaderBuilder
public StoredProcedureItemReaderBuilder()
方法详细资料
saveState
public StoredProcedureItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
name
public StoredProcedureItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- 参数:
name
- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
maxItemCount
public StoredProcedureItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- 参数:
maxItemCount
- the max items to be read- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
currentItemCount
public StoredProcedureItemReaderBuilder<T> currentItemCount(int currentItemCount)
Index for the current item. Used on restarts to indicate where to start from.- 参数:
currentItemCount
- current index- 返回:
- this instance for method chaining
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
dataSource
public StoredProcedureItemReaderBuilder<T> dataSource(javax.sql.DataSource dataSource)
TheDataSource
to read from- 参数:
dataSource
- a relational data base- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setDataSource(DataSource)
fetchSize
public StoredProcedureItemReaderBuilder<T> fetchSize(int fetchSize)
A hint to the driver as to how many rows to return with each fetch.- 参数:
fetchSize
- the hint- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setFetchSize(int)
maxRows
public StoredProcedureItemReaderBuilder<T> maxRows(int maxRows)
The max number of rows theResultSet
can contain- 参数:
maxRows
- the max- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setMaxRows(int)
queryTimeout
public StoredProcedureItemReaderBuilder<T> queryTimeout(int queryTimeout)
The time in milliseconds for the query to timeout- 参数:
queryTimeout
- timeout- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setQueryTimeout(int)
ignoreWarnings
public StoredProcedureItemReaderBuilder<T> ignoreWarnings(boolean ignoreWarnings)
Indicates if SQL warnings should be ignored or if an exception should be thrown.- 参数:
ignoreWarnings
- indicator. Defaults to true- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setIgnoreWarnings(boolean)
verifyCursorPosition
public StoredProcedureItemReaderBuilder<T> verifyCursorPosition(boolean verifyCursorPosition)
Indicates if the reader should verify the current position of theResultSet
after being passed to theRowMapper
. Defaults to true.- 参数:
verifyCursorPosition
- indicator- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setVerifyCursorPosition(boolean)
driverSupportsAbsolute
public StoredProcedureItemReaderBuilder<T> driverSupportsAbsolute(boolean driverSupportsAbsolute)
Indicates if the JDBC driver supports setting the absolute row on theResultSet
.- 参数:
driverSupportsAbsolute
- indicator- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setDriverSupportsAbsolute(boolean)
useSharedExtendedConnection
public StoredProcedureItemReaderBuilder<T> useSharedExtendedConnection(boolean useSharedExtendedConnection)
Indicates that the connection used for the cursor is being used by all other processing, therefor part of the same transaction.- 参数:
useSharedExtendedConnection
- indicator- 返回:
- this instance for method chaining
- 另请参阅:
AbstractCursorItemReader.setUseSharedExtendedConnection(boolean)
preparedStatementSetter
public StoredProcedureItemReaderBuilder<T> preparedStatementSetter(org.springframework.jdbc.core.PreparedStatementSetter preparedStatementSetter)
Configures the providedPreparedStatementSetter
to be used to populate any arguments in the SQL query to be executed for the reader.- 参数:
preparedStatementSetter
- setter- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setPreparedStatementSetter(PreparedStatementSetter)
rowMapper
public StoredProcedureItemReaderBuilder<T> rowMapper(org.springframework.jdbc.core.RowMapper<T> rowMapper)
TheRowMapper
used to map the results of the cursor to each item.- 参数:
rowMapper
-RowMapper
- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setRowMapper(RowMapper)
procedureName
public StoredProcedureItemReaderBuilder<T> procedureName(java.lang.String procedureName)
The name of the stored procedure to execute- 参数:
procedureName
- name of the procedure- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setProcedureName(String)
parameters
public StoredProcedureItemReaderBuilder<T> parameters(org.springframework.jdbc.core.SqlParameter[] parameters)
SQL parameters to be set when executing the stored procedure- 参数:
parameters
- parameters to be set- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setParameters(SqlParameter[])
function
public StoredProcedureItemReaderBuilder<T> function()
Indicates the stored procedure is a function- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setFunction(boolean)
refCursorPosition
public StoredProcedureItemReaderBuilder<T> refCursorPosition(int refCursorPosition)
The parameter position of the REF CURSOR. Only used for Oracle and PostgreSQL that use REF CURSORs. For any other database, this should remain as the default (0).- 参数:
refCursorPosition
- the parameter position- 返回:
- this instance for method chaining
- 另请参阅:
StoredProcedureItemReader.setRefCursorPosition(int)
build
public StoredProcedureItemReader<T> build()
Validates configuration and builds a new reader instance- 返回:
- a fully constructed
StoredProcedureItemReader