类 JdbcPagingItemReader<T>

  • 所有已实现的接口:
    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).

    从以下版本开始:
    2.0
    作者:
    Thomas Risberg, Dave Syer, Michael Minella, Mahmoud Ben Hassine