类 JdbcCursorItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.database.builder.JdbcCursorItemReaderBuilder<T>
public class JdbcCursorItemReaderBuilder<T> extends java.lang.Object
Builder for theJdbcCursorItemReader
- 从以下版本开始:
- 4.0
- 作者:
- Michael Minella, Glenn Renfro
构造器概要
构造器 构造器 说明 JdbcCursorItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 JdbcCursorItemReaderBuilder<T>
beanRowMapper(java.lang.Class<T> mappedClass)
Creates aBeanPropertyRowMapper
to be used as yourRowMapper
.JdbcCursorItemReader<T>
build()
Validates configuration and builds a new reader instance.JdbcCursorItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.JdbcCursorItemReaderBuilder<T>
dataSource(javax.sql.DataSource dataSource)
TheDataSource
to read fromJdbcCursorItemReaderBuilder<T>
driverSupportsAbsolute(boolean driverSupportsAbsolute)
Indicates if the JDBC driver supports setting the absolute row on theResultSet
.JdbcCursorItemReaderBuilder<T>
fetchSize(int fetchSize)
A hint to the driver as to how many rows to return with each fetch.JdbcCursorItemReaderBuilder<T>
ignoreWarnings(boolean ignoreWarnings)
JdbcCursorItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.JdbcCursorItemReaderBuilder<T>
maxRows(int maxRows)
The max number of rows theResultSet
can containJdbcCursorItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.JdbcCursorItemReaderBuilder<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.JdbcCursorItemReaderBuilder<T>
queryArguments(java.lang.Object[] args)
Configures aPreparedStatementSetter
that will use the array as the values to be set on the query to be executed for this reader.JdbcCursorItemReaderBuilder<T>
queryArguments(java.lang.Object[] args, int[] types)
Configures aPreparedStatementSetter
that will use the Object [] as the values to be set on the query to be executed for this reader.JdbcCursorItemReaderBuilder<T>
queryArguments(java.util.List<?> args)
Configures aPreparedStatementSetter
that will use the List as the values to be set on the query to be executed for this reader.JdbcCursorItemReaderBuilder<T>
queryTimeout(int queryTimeout)
The time in milliseconds for the query to timeoutJdbcCursorItemReaderBuilder<T>
rowMapper(org.springframework.jdbc.core.RowMapper<T> rowMapper)
TheRowMapper
used to map the results of the cursor to each item.JdbcCursorItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.JdbcCursorItemReaderBuilder<T>
sql(java.lang.String sql)
The query to be executed for this readerJdbcCursorItemReaderBuilder<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.JdbcCursorItemReaderBuilder<T>
verifyCursorPosition(boolean verifyCursorPosition)
Indicates if the reader should verify the current position of theResultSet
after being passed to theRowMapper
.
构造器详细资料
JdbcCursorItemReaderBuilder
public JdbcCursorItemReaderBuilder()
方法详细资料
saveState
public JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<T> ignoreWarnings(boolean ignoreWarnings)
verifyCursorPosition
public JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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 JdbcCursorItemReaderBuilder<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
- 另请参阅:
JdbcCursorItemReader.setPreparedStatementSetter(PreparedStatementSetter)
queryArguments
public JdbcCursorItemReaderBuilder<T> queryArguments(java.lang.Object[] args)
Configures aPreparedStatementSetter
that will use the array as the values to be set on the query to be executed for this reader.- 参数:
args
- values to set on the reader query- 返回:
- this instance for method chaining
queryArguments
public JdbcCursorItemReaderBuilder<T> queryArguments(java.lang.Object[] args, int[] types)
Configures aPreparedStatementSetter
that will use the Object [] as the values to be set on the query to be executed for this reader. The int[] will provide the types (Types
) for each of the values provided.- 参数:
args
- values to set on the querytypes
- the type for each value in the args array- 返回:
- this instance for method chaining
queryArguments
public JdbcCursorItemReaderBuilder<T> queryArguments(java.util.List<?> args) throws java.lang.Exception
Configures aPreparedStatementSetter
that will use the List as the values to be set on the query to be executed for this reader.- 参数:
args
- values to set on the query- 返回:
- this instance for method chaining
- 抛出:
java.lang.Exception
- fromInitializingBean.afterPropertiesSet()
sql
public JdbcCursorItemReaderBuilder<T> sql(java.lang.String sql)
The query to be executed for this reader- 参数:
sql
- query- 返回:
- this instance for method chaining
- 另请参阅:
JdbcCursorItemReader.setSql(String)
rowMapper
public JdbcCursorItemReaderBuilder<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
- 另请参阅:
JdbcCursorItemReader.setRowMapper(RowMapper)
beanRowMapper
public JdbcCursorItemReaderBuilder<T> beanRowMapper(java.lang.Class<T> mappedClass)
Creates aBeanPropertyRowMapper
to be used as yourRowMapper
.- 参数:
mappedClass
- the class for the row mapper- 返回:
- this instance for method chaining
- 另请参阅:
BeanPropertyRowMapper
build
public JdbcCursorItemReader<T> build()
Validates configuration and builds a new reader instance.- 返回:
- a fully constructed
JdbcCursorItemReader