Class HibernateRecordReader<T>

  • Type Parameters:
    T - the type of objects this reader will read.
    All Implemented Interfaces:
    org.jeasy.batch.core.reader.RecordReader<T>

    public class HibernateRecordReader<T>
    extends java.lang.Object
    implements org.jeasy.batch.core.reader.RecordReader<T>
    Read records using Hibernate API. This reader produces GenericRecord instances with domain objects as payload.
    Author:
    Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void open()  
      org.jeasy.batch.core.record.GenericRecord<T> readRecord()  
      void setFetchSize​(int fetchSize)
      Set the fetch size
      void setMaxResults​(int maxResults)
      Set the max results to fetch.
      • Methods inherited from class java.lang.Object

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

      • HibernateRecordReader

        public HibernateRecordReader​(org.hibernate.SessionFactory sessionFactory,
                                     java.lang.String query)
        Create a new HibernateRecordReader.
        Parameters:
        sessionFactory - a pre-configured hibernate session factory
        query - the HQL query to use to fetch data
    • Method Detail

      • open

        public void open()
        Specified by:
        open in interface org.jeasy.batch.core.reader.RecordReader<T>
      • readRecord

        public org.jeasy.batch.core.record.GenericRecord<T> readRecord()
        Specified by:
        readRecord in interface org.jeasy.batch.core.reader.RecordReader<T>
      • close

        public void close()
        Specified by:
        close in interface org.jeasy.batch.core.reader.RecordReader<T>
      • setMaxResults

        public void setMaxResults​(int maxResults)
        Set the max results to fetch.
        Parameters:
        maxResults - the maximum results to fetch
      • setFetchSize

        public void setFetchSize​(int fetchSize)
        Set the fetch size
        Parameters:
        fetchSize - the fetch size