Class EntityIdReader
java.lang.Object
jakarta.batch.api.chunk.AbstractItemReader
org.hibernate.search.jakarta.batch.core.massindexing.step.spi.EntityIdReader
- All Implemented Interfaces:
ItemReader
@Named("org.hibernate.search.jsr352.massindexing.impl.steps.lucene.EntityReader")
@HibernateSearchPartitionScoped
public class EntityIdReader
extends AbstractItemReader
Reads entity identifiers from the database.
This reader builds a scroll and outputs IDs from that scroll.
Each reader pertains to only one entity type.
The reading range is restricted by the PartitionBound
, which always represents a left-closed interval.
See HibernateSearchPartitionMapper
for more information about these bounds.
- Author:
- Mincong Huang
-
Constructor Summary
ConstructorsConstructorDescriptionEntityIdReader
(String entityName, String serializedIdFetchSize, String reindexOnlyHql, String serializedReindexOnlyParameters, String serializedMaxResultsPerEntity, String partitionIdStr, String serializedLowerBound, String serializedUpperBound, JobContext jobContext, StepContext stepContext) -
Method Summary
Modifier and TypeMethodDescriptionThe checkpointInfo method returns the current checkpoint data for this reader.void
close()
Close operation(s) before the class destruction.void
open
(Serializable checkpointInfo) Initialize the environment.readItem()
Read item from database using JPA.
-
Constructor Details
-
EntityIdReader
public EntityIdReader() -
EntityIdReader
public EntityIdReader(String entityName, String serializedIdFetchSize, String reindexOnlyHql, String serializedReindexOnlyParameters, String serializedMaxResultsPerEntity, String partitionIdStr, String serializedLowerBound, String serializedUpperBound, JobContext jobContext, StepContext stepContext)
-
-
Method Details
-
open
Initialize the environment. If checkpoint does not exist, then it should be the first open. If checkpoint exists, then it isn't the first open, re-use the input object "checkpoint" as the last ID already read.- Specified by:
open
in interfaceItemReader
- Overrides:
open
in classAbstractItemReader
- Parameters:
checkpointInfo
- The last checkpoint info persisted in the batch runtime, previously given by checkpointInfo(). If this is the first start, then the checkpoint will be null.- Throws:
IOException
ClassNotFoundException
-
close
public void close()Close operation(s) before the class destruction.- Specified by:
close
in interfaceItemReader
- Overrides:
close
in classAbstractItemReader
-
readItem
Read item from database using JPA. Each read, there will be only one identifier fetched.- Specified by:
readItem
in interfaceItemReader
- Specified by:
readItem
in classAbstractItemReader
-
checkpointInfo
The checkpointInfo method returns the current checkpoint data for this reader. It is called before a chunk checkpoint is committed.- Specified by:
checkpointInfo
in interfaceItemReader
- Overrides:
checkpointInfo
in classAbstractItemReader
- Returns:
- the checkpoint info
-