org.mybatis.spring.batch
Class MyBatisPagingItemReader<T>

java.lang.Object
  extended by org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
      extended by org.springframework.batch.item.database.AbstractPagingItemReader<T>
          extended by org.mybatis.spring.batch.MyBatisPagingItemReader<T>
All Implemented Interfaces:
org.springframework.batch.item.ItemReader<T>, org.springframework.batch.item.ItemStream, org.springframework.beans.factory.InitializingBean

public class MyBatisPagingItemReader<T>
extends org.springframework.batch.item.database.AbstractPagingItemReader<T>

org.springframework.batch.item.ItemReader for reading database records using MyBatis in a paging fashion. Provided to facilitate the migration from Spring-Batch iBATIS 2 page item readers to MyBatis 3.

Since:
1.1.0

Field Summary
 
Fields inherited from class org.springframework.batch.item.database.AbstractPagingItemReader
logger, results
 
Constructor Summary
MyBatisPagingItemReader()
           
 
Method Summary
 void afterPropertiesSet()
          Check mandatory properties.
protected  void doJumpToPage(int itemIndex)
           
protected  void doReadPage()
           
 void setParameterValues(Map<String,Object> parameterValues)
          The parameter values to be used for the query execution.
 void setQueryId(String queryId)
          Public setter for the statement id identifying the statement in the SqlMap configuration file.
 void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
          Public setter for SqlSessionFactory for injection purposes.
 
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, getExecutionContextUserSupport, isSaveState, 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
 

Constructor Detail

MyBatisPagingItemReader

public MyBatisPagingItemReader()
Method Detail

setSqlSessionFactory

public void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
Public setter for SqlSessionFactory for injection purposes.

Parameters:
SqlSessionFactory - sqlSessionFactory

setQueryId

public void setQueryId(String queryId)
Public setter for the statement id identifying the statement in the SqlMap configuration file.

Parameters:
queryId - the id for the statement

setParameterValues

public void setParameterValues(Map<String,Object> parameterValues)
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 Exception
Check mandatory properties.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class org.springframework.batch.item.database.AbstractPagingItemReader<T>
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

doReadPage

protected void doReadPage()
Specified by:
doReadPage in class org.springframework.batch.item.database.AbstractPagingItemReader<T>

doJumpToPage

protected void doJumpToPage(int itemIndex)
Specified by:
doJumpToPage in class org.springframework.batch.item.database.AbstractPagingItemReader<T>


Copyright © 2010-2012 MyBatis.org. All Rights Reserved.