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.voidclose()Close operation(s) before the class destruction.voidopen(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:
openin interfaceItemReader- Overrides:
openin 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:
IOExceptionClassNotFoundException
-
close
public void close()Close operation(s) before the class destruction.- Specified by:
closein interfaceItemReader- Overrides:
closein classAbstractItemReader
-
readItem
Read item from database using JPA. Each read, there will be only one identifier fetched.- Specified by:
readItemin interfaceItemReader- Specified by:
readItemin classAbstractItemReader
-
checkpointInfo
The checkpointInfo method returns the current checkpoint data for this reader. It is called before a chunk checkpoint is committed.- Specified by:
checkpointInfoin interfaceItemReader- Overrides:
checkpointInfoin classAbstractItemReader- Returns:
- the checkpoint info
-