No automatic reindexing when changing a property annotated with @OneToOne(mappedBy = ...) @IndexedEmbedded

Description

This is a more serious variation of https://hibernate.atlassian.net/browse/HSEARCH-4305 that only happens with Hibernate ORM 5.6.12+, 6.1.4+ and 6.2.0+.

Essentially, Hibernate Search is not getting a post-update event when a property annotated with @OneToOne(mappedBy = ...) is modified, so it does not trigger reindexing accordingly.

Activity

Show:

Yoann Rodière September 29, 2022 at 2:01 PM

You can find the whole conversation there: https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/Events.20on.20change.20of.20non-owning.20side.20of.20associations

The gist of it:

  • Hibernate ORM used not to trigger any event for changes to a @OneToOne(mappedBy = ...)

  • it started triggering events in some cases after https://hibernate.atlassian.net/browse/HHH-14216 was fixed

  • Hibernate Search has been relying on that new behavior ever since

  • But https://hibernate.atlassian.net/browse/HHH-14216 has been causing loads of issues, to such a point that the patch was reverted in https://hibernate.atlassian.net/browse/HHH-15045

  • Moving forward, Hibernate ORM could provide additional events for @OneToOne(mappedBy = ...), but that would probably be a new event type: JPA specifies that @PostUpdate events are about database updates, so we probably don’t want them to be triggered for @OneToOne(mappedBy = ...) .

With that in mind, I’ll work on a limited implementation of https://hibernate.atlassian.net/browse/HSEARCH-3567 , just for non-owning ToOne associations; that should allow us to fix this bug with limited impact on usability and performance.

Fixed

Assignee

Reporter

Components

Sprint

Priority

Created September 28, 2022 at 10:39 AM
Updated February 2, 2023 at 9:10 AM
Resolved October 19, 2022 at 4:03 PM