public class JdbcPagingItemReaderBuilder<T>
extends java.lang.Object
JdbcPagingItemReader
. When configuring, either a
PagingQueryProvider
or the SQL fragments should be provided. If the SQL
fragments are provided, the metadata from the provided DataSource
will be used
to create a PagingQueryProvider for you. If both are provided, the PagingQueryProvider
will be used.JdbcPagingItemReader
Constructor and Description |
---|
JdbcPagingItemReaderBuilder() |
Modifier and Type | Method and Description |
---|---|
JdbcPagingItemReader<T> |
build()
Provides a completely built instance of the
JdbcPagingItemReader |
JdbcPagingItemReaderBuilder<T> |
currentItemCount(int currentItemCount)
Index for the current item.
|
JdbcPagingItemReaderBuilder<T> |
dataSource(javax.sql.DataSource dataSource)
The
DataSource to query against. |
JdbcPagingItemReaderBuilder<T> |
fetchSize(int fetchSize)
A hint to the underlying RDBMS as to how many records to return with each fetch.
|
JdbcPagingItemReaderBuilder<T> |
fromClause(java.lang.String fromClause)
The SQL
FROM clause for a db specific PagingQueryProvider . |
JdbcPagingItemReaderBuilder<T> |
groupClause(java.lang.String groupClause)
The SQL
GROUP BY clause for a db specific @PagingQueryProvider . |
JdbcPagingItemReaderBuilder<T> |
maxItemCount(int maxItemCount)
Configure the max number of items to be read.
|
JdbcPagingItemReaderBuilder<T> |
name(java.lang.String name)
The name used to calculate the key within the
ExecutionContext . |
JdbcPagingItemReaderBuilder<T> |
pageSize(int pageSize)
The number of records to request per page/query.
|
JdbcPagingItemReaderBuilder<T> |
parameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
A
Map of values to set on the SQL's prepared statement. |
JdbcPagingItemReaderBuilder<T> |
queryProvider(PagingQueryProvider provider)
A
PagingQueryProvider to provide the queries required. |
JdbcPagingItemReaderBuilder<T> |
rowMapper(org.springframework.jdbc.core.RowMapper<T> rowMapper)
The
RowMapper used to map the query results to objects. |
JdbcPagingItemReaderBuilder<T> |
saveState(boolean saveState)
Configure if the state of the
ItemStreamSupport
should be persisted within the ExecutionContext
for restart purposes. |
JdbcPagingItemReaderBuilder<T> |
selectClause(java.lang.String selectClause)
The SQL
SELECT clause for a db specific PagingQueryProvider . |
JdbcPagingItemReaderBuilder<T> |
sortKeys(java.util.Map<java.lang.String,Order> sortKeys)
The keys to sort by.
|
JdbcPagingItemReaderBuilder<T> |
whereClause(java.lang.String whereClause)
The SQL
WHERE clause for a db specific PagingQueryProvider . |
public JdbcPagingItemReaderBuilder<T> saveState(boolean saveState)
ItemStreamSupport
should be persisted within the ExecutionContext
for restart purposes.saveState
- defaults to truepublic JdbcPagingItemReaderBuilder<T> name(java.lang.String name)
ExecutionContext
. Required if
saveState(boolean)
is set to true.name
- name of the reader instanceItemStreamSupport.setName(String)
public JdbcPagingItemReaderBuilder<T> maxItemCount(int maxItemCount)
maxItemCount
- the max items to be readAbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
public JdbcPagingItemReaderBuilder<T> currentItemCount(int currentItemCount)
currentItemCount
- current indexAbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
public JdbcPagingItemReaderBuilder<T> dataSource(javax.sql.DataSource dataSource)
DataSource
to query against. Required.dataSource
- the DataSource
JdbcPagingItemReader.setDataSource(DataSource)
public JdbcPagingItemReaderBuilder<T> fetchSize(int fetchSize)
fetchSize
- number of recordsJdbcPagingItemReader.setFetchSize(int)
public JdbcPagingItemReaderBuilder<T> rowMapper(org.springframework.jdbc.core.RowMapper<T> rowMapper)
RowMapper
used to map the query results to objects. Required.rowMapper
- a RowMapper
implementationJdbcPagingItemReader.setRowMapper(RowMapper)
public JdbcPagingItemReaderBuilder<T> parameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Map
of values to set on the SQL's prepared statement.parameterValues
- Map of valuesJdbcPagingItemReader.setParameterValues(Map)
public JdbcPagingItemReaderBuilder<T> pageSize(int pageSize)
pageSize
- number of itemsAbstractPagingItemReader.setPageSize(int)
public JdbcPagingItemReaderBuilder<T> groupClause(java.lang.String groupClause)
GROUP BY
clause for a db specific @PagingQueryProvider
.
This is only used if a PagingQueryProvider is not provided.groupClause
- the SQL clauseAbstractSqlPagingQueryProvider.setGroupClause(String)
public JdbcPagingItemReaderBuilder<T> selectClause(java.lang.String selectClause)
SELECT
clause for a db specific PagingQueryProvider
.
This is only used if a PagingQueryProvider is not provided.selectClause
- the SQL clauseAbstractSqlPagingQueryProvider.setSelectClause(String)
public JdbcPagingItemReaderBuilder<T> fromClause(java.lang.String fromClause)
FROM
clause for a db specific PagingQueryProvider
.
This is only used if a PagingQueryProvider is not provided.fromClause
- the SQL clauseAbstractSqlPagingQueryProvider.setFromClause(String)
public JdbcPagingItemReaderBuilder<T> whereClause(java.lang.String whereClause)
WHERE
clause for a db specific PagingQueryProvider
.
This is only used if a PagingQueryProvider is not provided.whereClause
- the SQL clauseAbstractSqlPagingQueryProvider.setWhereClause(String)
public JdbcPagingItemReaderBuilder<T> sortKeys(java.util.Map<java.lang.String,Order> sortKeys)
sortKeys
- keys to sort by and the direction for each.AbstractSqlPagingQueryProvider.setSortKeys(Map)
public JdbcPagingItemReaderBuilder<T> queryProvider(PagingQueryProvider provider)
PagingQueryProvider
to provide the queries required. If provided, the
SQL fragments configured via selectClause(String)
,
fromClause(String)
, whereClause(String)
, groupClause
,
and sortKeys(Map)
are ignored.provider
- the db specific query providerJdbcPagingItemReader.setQueryProvider(PagingQueryProvider)
public JdbcPagingItemReader<T> build()
JdbcPagingItemReader
JdbcPagingItemReader