|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.item.database.AbstractPagingItemReader<T>
org.springframework.batch.item.database.JdbcPagingItemReader<T>
public class JdbcPagingItemReader<T>
ItemReader for reading database
records using JDBC in a paging fashion.
It executes the SQL built by the PagingQueryProvider to retrieve
requested data. The query is executed using paged requests of a size
specified in AbstractPagingItemReader.setPageSize(int). Additional pages are requested when
needed as AbstractItemCountingItemStreamItemReader.read() method is called, returning an object corresponding
to current position.
The performance of the paging depends on the database specific features available to limit the number of returned rows.
Setting a fairly large page size and using a commit interval that matches the page size should provide better performance.
The implementation is thread-safe in between calls to
AbstractItemCountingItemStreamItemReader.open(ExecutionContext), but remember to use
saveState=false if used in a multi-threaded client (no restart
available).
| Field Summary | |
|---|---|
static int |
VALUE_NOT_SET
|
| Fields inherited from class org.springframework.batch.item.database.AbstractPagingItemReader |
|---|
logger, results |
| Constructor Summary | |
|---|---|
JdbcPagingItemReader()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Check mandatory properties. |
protected void |
doJumpToPage(int itemIndex)
|
protected void |
doReadPage()
|
void |
setDataSource(DataSource dataSource)
|
void |
setFetchSize(int fetchSize)
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object. |
void |
setParameterValues(Map<String,Object> parameterValues)
The parameter values to be used for the query execution. |
void |
setQueryProvider(PagingQueryProvider queryProvider)
A PagingQueryProvider. |
void |
setRowMapper(RowMapper rowMapper)
The row mapper implementation to be used by this reader |
| Methods inherited from class org.springframework.batch.item.database.AbstractPagingItemReader |
|---|
doClose, doOpen, doRead, getPage, getPageSize, jumpToItem, setPageSize |
| Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader |
|---|
close, getCurrentItemCount, open, read, setCurrentItemCount, setMaxItemCount, setName, setSaveState, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VALUE_NOT_SET
| Constructor Detail |
|---|
public JdbcPagingItemReader()
| Method Detail |
|---|
public void setDataSource(DataSource dataSource)
public void setFetchSize(int fetchSize)
ResultSet object. If the fetch size specified is zero, the
JDBC driver ignores the value.
fetchSize - the number of rows to fetchResultSet.setFetchSize(int)public void setQueryProvider(PagingQueryProvider queryProvider)
PagingQueryProvider. Supplies all the platform dependent query
generation capabilities needed by the reader.
queryProvider - the PagingQueryProvider to usepublic void setRowMapper(RowMapper rowMapper)
rowMapper - a
ParameterizedRowMapper
implementationpublic void setParameterValues(Map<String,Object> parameterValues)
parameterValues - the values keyed by the parameter named/index used
in the query string.
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanafterPropertiesSet in class AbstractPagingItemReader<T>ExceptionInitializingBean.afterPropertiesSet()protected void doReadPage()
doReadPage in class AbstractPagingItemReader<T>protected void doJumpToPage(int itemIndex)
doJumpToPage in class AbstractPagingItemReader<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||