Class MyBatisCursorItemReader<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.mybatis.spring.batch.MyBatisCursorItemReader<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 MyBatisCursorItemReader<T> extends org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader<T> implements org.springframework.beans.factory.InitializingBean
ItemReader that uses MyBatis Cursor to read data.
Author:
Guillaume Darmont / guillaume@dropinocean.com
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new my batis cursor item reader.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Check mandatory properties.
    protected void
     
    protected void
     
    protected T
     
    void
    setParameterValues(Map<String,Object> parameterValues)
    The parameter values to be used for the query execution.
    void
    The parameter supplier used to get parameter values 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.infrastructure.item.support.AbstractItemCountingItemStreamItemReader

    close, getCurrentItemCount, isSaveState, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update

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

    getExecutionContextKey, getName, setBeanName, setExecutionContextName, setName

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MyBatisCursorItemReader

      public MyBatisCursorItemReader()
      Instantiates a new my batis cursor item reader.
  • Method Details

    • doRead

      protected T doRead() throws Exception
      Specified by:
      doRead in class org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader<T>
      Throws:
      Exception
    • doOpen

      protected void doOpen() throws Exception
      Specified by:
      doOpen in class org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader<T>
      Throws:
      Exception
    • doClose

      protected void doClose() throws Exception
      Specified by:
      doClose in class org.springframework.batch.infrastructure.item.support.AbstractItemCountingItemStreamItemReader<T>
      Throws:
      Exception
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Check mandatory properties.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
      See Also:
      • InitializingBean.afterPropertiesSet()
    • setSqlSessionFactory

      public void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
      Public setter for SqlSessionFactory for injection purposes.
      Parameters:
      sqlSessionFactory - a factory object for the SqlSession.
    • 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.
    • setParameterValuesSupplier

      public void setParameterValuesSupplier(Supplier<Map<String,Object>> parameterValuesSupplier)
      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