@Deprecated public class IbatisPagingItemReader<T> extends AbstractPagingItemReader<T>
ItemReader
for reading database
records using iBATIS in a paging fashion.
It executes the query specified as the setQueryId(String)
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. Some standard query parameters are provided by the
reader and the SQL in the named query must use some or all of these parameters
(depending on the SQL variant) to construct a result set of the required
size. The parameters are:
_page
: the page number to be read (starting at 0)_pagesize
: the size of the pages, i.e. the number of rows to
return_skiprows
: the product of _page
and
_pagesize
Failure to write the correct platform-specific SQL often results in an infinite loop in the reader because it keeps asking for the next page and gets the same result set over and over.
The performance of the paging depends on the iBATIS implementation. 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).
Note: This reader was refactored as part of Spring Batch 3.0 to use the iBatis APIs directly instead of using Spring's SqlMapClientTemplate as part of the upgrade to support Spring 4.
logger, results
Constructor and Description |
---|
IbatisPagingItemReader()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Deprecated.
Check mandatory properties.
|
protected void |
doJumpToPage(int itemIndex)
Deprecated.
|
protected void |
doReadPage()
Deprecated.
|
void |
setDataSource(javax.sql.DataSource dataSource)
Deprecated.
|
void |
setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Deprecated.
The parameter values to be used for the query execution.
|
void |
setQueryId(java.lang.String queryId)
Deprecated.
|
void |
setSqlMapClient(com.ibatis.sqlmap.client.SqlMapClient sqlMapClient)
Deprecated.
|
doClose, doOpen, doRead, getPage, getPageSize, jumpToItem, setPageSize
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
getExecutionContextKey, setExecutionContextName, setName
public void setDataSource(javax.sql.DataSource dataSource)
public void setSqlMapClient(com.ibatis.sqlmap.client.SqlMapClient sqlMapClient)
public void setQueryId(java.lang.String queryId)
public void setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
parameterValues
- the values keyed by the parameter named used in
the query string.public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class AbstractPagingItemReader<T>
java.lang.Exception
InitializingBean.afterPropertiesSet()
protected void doReadPage()
doReadPage
in class AbstractPagingItemReader<T>
protected void doJumpToPage(int itemIndex)
doJumpToPage
in class AbstractPagingItemReader<T>