Embeddable callbacks

Hi,
is there some way to add a callback to Embeddable similar to what entities have? E.g. PostUpdate/PostPersist or PostUpdateEventListener?

I have few collections in embeddables that need some extra processing after update/persist. For entities it works like a charm, but I’m having issues with Embeddable.

Thanks

AFAICS, this was implemented as part of [HHH-12326] - Hibernate JIRA. If you have trouble with the feature, please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

I just found this @ManyToMany and PostUpdateEventListener, my collection inside the embeddable is also ManyToMany. I guess this mean it won’t work, is that correct?

I tried @PreUpdate, event listeners on embeddable and nothing is called by hibernate when the collection is modified.

Hi @beikov,
If I have a collection in an entity either ManyToMany or OneToMany, should the owning entity be notified in PreUpdate/PostUpdate when I modify the collection?

That’s a good question. I think you should start a discussion about this on our Zulip chat platform.

Solved by using PreCollectionRecreateEventListener and PreCollectionUpdateEventListener.

2 Likes