I have two entities (entityA and entityB), one which contain another with @IndexedEmbedded, because when I search, I want to query by entityB as well, and return entityA.
The relationship (simplified) is as such:
public class EntityA {
private String name;
@OneToMany
@IndexedEmbedded
private List<EntityB> children;
}
public class EntityB {
@ManyToOne
@ContainedIn
private EntityA parent;
private String childName;
}
I am having issues now because relationally, the "children" in entityA can have up to 100k items. This causes OutOfMemory issue no matter if I am using FullTextSession.index or the MassIndexer.
I could actually remove the @OneToMany mapping in EntityA because when I want to access EntityB, I will usually do a query with some filtering and pagination, but if I remove the @OneToMany, then Hibernate Search will not index my EntityB.
Is there anyway to get the FullTextSession.index to perform indexing based on batch on the "children"?
I feel you should remove that relationship like one to many and many to one and write a join query to fetch the results of desired size, fetching 100k rows kills the mem.
Thnx, Subhash