Class HibernateRecordReader<T>
- java.lang.Object
-
- org.jeasy.batch.extensions.hibernate.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 producesGenericRecordinstances with domain objects as payload.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description HibernateRecordReader(org.hibernate.SessionFactory sessionFactory, java.lang.String query)Create a newHibernateRecordReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidopen()org.jeasy.batch.core.record.GenericRecord<T>readRecord()voidsetFetchSize(int fetchSize)Set the fetch sizevoidsetMaxResults(int maxResults)Set the max results to fetch.
-
-
-
Constructor Detail
-
HibernateRecordReader
public HibernateRecordReader(org.hibernate.SessionFactory sessionFactory, java.lang.String query)Create a newHibernateRecordReader.- Parameters:
sessionFactory- a pre-configured hibernate session factoryquery- the HQL query to use to fetch data
-
-
Method Detail
-
open
public void open()
- Specified by:
openin interfaceorg.jeasy.batch.core.reader.RecordReader<T>
-
readRecord
public org.jeasy.batch.core.record.GenericRecord<T> readRecord()
- Specified by:
readRecordin interfaceorg.jeasy.batch.core.reader.RecordReader<T>
-
close
public void close()
- Specified by:
closein interfaceorg.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
-
-