Hello.
We are using Hibernate inside WildFly (v10) JEE container.
We use @EntityListeners where we fire a CDI event inside a method annotated with @PreUpdate.
These are the CDI observer methods listening to the events fired in the EntityListener:
Code:
@Asynchronous
public void onSuccess(@Observes(during = TransactionPhase.AFTER_SUCCESS) MyData event) {
@Asynchronous
public void onFailure(@Observes(during = TransactionPhase.AFTER_FAILURE) MyData event) {
What is strange here, is that always the onFailure() method is called although the data is written to the db and no exceptions or any errors can be seen - meaning the transaction has been comitted.
We also use RootAware[1] for the children entities. Don't know, if this matters.
Would be great, if anyone could explain, why this is not working as expected!
Thanks,
Michael
[1]
https://vladmihalcea.com/how-to-increme ... hibernate/