添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
想表白的四季豆  ·  List<string> ...·  7 月前    · 
成熟的脸盆  ·  成功解决 TypeError: type ...·  1 年前    · 
独立的长颈鹿  ·  html转pdf分页 ...·  1 年前    · 
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemReader <T>
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader <T>
org.springframework.batch.item.database.AbstractPagingItemReader <T>
org.springframework.batch.item.database.JdbcPagingItemReader<T>
All Implemented Interfaces:
ItemReader <T> , ItemStream , ItemStreamReader <T> , org.springframework.beans.factory.InitializingBean
public class JdbcPagingItemReader<T> extends AbstractPagingItemReader <T> implements org.springframework.beans.factory.InitializingBean
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. On restart it uses the last sort key value to locate the first page to read (so it doesn't matter if the successfully processed items have been removed or modified). It is important to have a unique key constraint on the sort key to guarantee that no data is lost between executions. 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 open(ExecutionContext) , but remember to use saveState=false if used in a multi-threaded client (no restart available).
Since:
Author:
Thomas Risberg, Dave Syer, Michael Minella, Mahmoud Ben Hassine

Fields inherited from class org.springframework.batch.item.database. AbstractPagingItemReader

logger , results
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.
The parameter values to be used for the query execution.
setRowMapper (org.springframework.jdbc.core.RowMapper< T > rowMapper)
The row mapper implementation to be used by this reader.
update ( ExecutionContext executionContext)
Return empty ExecutionContext .

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 , isSaveState , read , setCurrentItemCount , setMaxItemCount , setSaveState

Methods inherited from class org.springframework.batch.item. ItemStreamSupport

getExecutionContextKey , getName , setExecutionContextName , setName

Methods inherited from class java.lang. Object

clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait

setFetchSize

public 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. If the fetch size specified is zero, the JDBC driver ignores the value.
Parameters:
fetchSize - the number of rows to fetch
See Also:
  • ResultSet.setFetchSize(int)
  • setQueryProvider

    public void setQueryProvider ( PagingQueryProvider queryProvider)
    A PagingQueryProvider . Supplies all the platform dependent query generation capabilities needed by the reader.
    Parameters:
    queryProvider - the PagingQueryProvider to use

    setRowMapper

    public void setRowMapper (org.springframework.jdbc.core.RowMapper< T > rowMapper)
    The row mapper implementation to be used by this reader. The row mapper is used to convert result set rows into objects, which are then returned by the reader.
    Parameters:
    rowMapper - a RowMapper implementation

    setParameterValues

    public void setParameterValues ( Map < String , Object > parameterValues)
    The parameter values to be used for the query execution. If you use named parameters then the key should be the name used in the query clause. If you use "?" placeholders then the key should be the relative index that the parameter appears in the query string built using the select, from and where clauses specified.
    Parameters:
    parameterValues - the values keyed by the parameter named/index used in the query string.
    Specified by:
    afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    Overrides:
    afterPropertiesSet in class AbstractPagingItemReader < T >
    Throws:
    Exception
    See Also:
  • InitializingBean.afterPropertiesSet()
  • update

    public void update ( ExecutionContext executionContext) throws ItemStreamException
    Description copied from class: ItemStreamSupport
    Return empty ExecutionContext .
    Specified by:
    update in interface ItemStream
    Overrides:
    update in class AbstractItemCountingItemStreamItemReader < T >
    Parameters:
    executionContext - to be updated
    Throws:
    ItemStreamException
    See Also:
  • ItemStream.update(ExecutionContext)
  • public void open ( ExecutionContext executionContext)
    Description copied from class: ItemStreamSupport
    No-op.
    Specified by:
    open in interface ItemStream
    Overrides:
    open in class AbstractItemCountingItemStreamItemReader < T >
    Parameters:
    executionContext - current step's ExecutionContext . Will be the executionContext from the last run of the step on a restart.
    See Also:
  • ItemStream.open(ExecutionContext)
  •