org.springframework.batch.item.database

## Class IbatisPagingItemReader<T>

- 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.IbatisPagingItemReader<T>

- All Implemented Interfaces:
    ItemReader<T>, ItemStream, ItemStreamReader<T>, org.springframework.beans.factory.InitializingBean

  Deprecated.
  as of Spring Batch 3.0, in favor of the native Spring Batch support in the MyBatis follow-up project (http://mybatis.github.io/spring/)

      @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.

  Since:
    2.0
  Author:
    Thomas Risberg, Dave Syer, Michael Minella

- - ### Field Summary

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

      `logger, results`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IbatisPagingItemReader()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    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.

    - ### 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, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update`

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

      `getExecutionContextKey, setExecutionContextName, setName`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### IbatisPagingItemReader

          public IbatisPagingItemReader()

      Deprecated.

  - ### Method Detail

    - #### setDataSource

          public void setDataSource(javax.sql.DataSource dataSource)

      Deprecated.

    - #### setSqlMapClient

          public void setSqlMapClient(com.ibatis.sqlmap.client.SqlMapClient sqlMapClient)

      Deprecated.

    - #### setQueryId

          public void setQueryId(java.lang.String queryId)

      Deprecated.

    - #### setParameterValues

          public void setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)

      Deprecated.
      The parameter values to be used for the query execution.
      Parameters:
        `parameterValues` - the values keyed by the parameter named used in the query string.

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws java.lang.Exception

      Deprecated.
      Check mandatory properties.
      Specified by:
        `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `AbstractPagingItemReader<T>`
      Throws:
        `java.lang.Exception`
      See Also:
        `InitializingBean.afterPropertiesSet()`

    - #### doReadPage

          protected void doReadPage()

      Deprecated.
      Specified by:
        `doReadPage` in class `AbstractPagingItemReader<T>`

    - #### doJumpToPage

          protected void doJumpToPage(int itemIndex)

      Deprecated.
      Specified by:
        `doJumpToPage` in class `AbstractPagingItemReader<T>`