HSEARCH700084: Exception while resolving other entities to reindex as a result of changes on entity

Hello, I´m using HibernateSearch verison 6.1.6.Final and facing this reindexing exception:

org.hibernate.search.util.common.SearchException: HSEARCH700084: Exception while resolving other entities to reindex as a result of changes on entity A#1138251': null Context: path '.listOfB

in case of deletion of indexed entity A that has association to other indexed entity B like this (simplified):

@Indexed(index="index_a")
@Table(name = "table_a")
public class A {
    @OneToMany(mappedBy = "a")
    @EqualsAndHashCode.Exclude
    private List<B> listOfB;}
@Indexed(index="index_b")
@Table(name = "table_b")
public class B {
    @Column(name = "a_id")
    @GenericField
    private Long aId;
    @ManyToOne
    @JoinColumn(name = "a_id", insertable = false, updatable = false)
    private A a;
}

both entities also use TypeBinder and define inverse path context dependency one to each other (simplified):

In TypeBinder for A:

context.dependencies()
.fromOtherEntity(B.class, B.Fields.a)
.use(B.Fields.someField);

In TypeBinder for B:

context.dependencies()
.fromOtherEntity(A.class,A.Fields.listOfB)
.use(A.Fields.someField);

Is there any solution to be able to delete entity A without facing the exception while in moment of deletion A is ensured that there is no associated B to A?
Thank you very much!

Hey,

Thanks for reaching out. I assume you’ve encountered the problem described in here. Do you update the B side of the association? Adding a code example of how you remove the entity could help.

Thank you for reply. Deletion of A is done by implementation of CrudRepository from org.springframework.data.repository using method deleteById(). How should I update B side of association if there is no associated B entity in the moment of deletion of A? (noting that A to B is 1:n relation)

CrudRepository from org.springframework.data.repository using method deleteById()

Hmm not sure how this one is actually implemented :see_no_evil: :smiley:. Maybe you could create a reproducer using a template hibernate-test-case-templates/search/hibernate-search-6/orm-lucene at main · hibernate/hibernate-test-case-templates · GitHub, so it’ll be easier to see what’s happening in your case? thanks!