Class MyBatisPagingItemReader<T>
java.lang.Object
org.springframework.batch.infrastructure.item.ItemStreamSupport
org.springframework.batch.infrastructure.item.support.AbstractItemStreamItemReader<T>
org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.infrastructure.item.database.AbstractPagingItemReader<T>
org.mybatis.spring.batch.MyBatisPagingItemReader<T>
- Type Parameters:
T- the generic type
- All Implemented Interfaces:
org.springframework.batch.infrastructure.item.ItemReader<T>, org.springframework.batch.infrastructure.item.ItemStream, org.springframework.batch.infrastructure.item.ItemStreamReader<T>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
public class MyBatisPagingItemReader<T>
extends org.springframework.batch.infrastructure.item.database.AbstractPagingItemReader<T>
org.springframework.batch.infrastructure.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
- Author:
- Eduardo Macarron
-
Field Summary
Fields inherited from class org.springframework.batch.infrastructure.item.database.AbstractPagingItemReader
logger, results -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck mandatory properties.protected voidvoidsetParameterValues(Map<String, Object> parameterValues) The parameter values to be used for the query execution.voidsetParameterValuesSupplier(Supplier<Map<String, Object>> parameterValuesSupplier) The parameter supplier used to get parameter values for the query execution.voidsetQueryId(String queryId) Public setter for the statement id identifying the statement in the SqlMap configuration file.voidsetSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory) Public setter forSqlSessionFactoryfor injection purposes.Methods inherited from class org.springframework.batch.infrastructure.item.database.AbstractPagingItemReader
doClose, doOpen, doRead, getPage, getPageSize, jumpToItem, setPageSizeMethods inherited from class org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, updateMethods inherited from class org.springframework.batch.infrastructure.item.ItemStreamSupport
getExecutionContextKey, getName, setBeanName, setExecutionContextName, setName
-
Constructor Details
-
MyBatisPagingItemReader
public MyBatisPagingItemReader()Instantiates a new my batis paging item reader.
-
-
Method Details
-
setSqlSessionFactory
public void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory) Public setter forSqlSessionFactoryfor injection purposes.- Parameters:
sqlSessionFactory- a factory object for theSqlSession.
-
setQueryId
Public setter for the statement id identifying the statement in the SqlMap configuration file.- Parameters:
queryId- the id for the statement
-
setParameterValues
-
setParameterValuesSupplier
The parameter supplier used to get parameter values for the query execution.- Parameters:
parameterValuesSupplier- the supplier used to get values keyed by the parameter named used in the query string.- Since:
- 2.1.0
-
afterPropertiesSet
Check mandatory properties. -
doReadPage
protected void doReadPage()- Specified by:
doReadPagein classorg.springframework.batch.infrastructure.item.database.AbstractPagingItemReader<T>
-