Hi all,
I get this error No transaction is currently active
when I use the after commit event.
I have followed this example below, no matter what I do, I do get the above error.
https://docs.jmix.io/1.x/jmix/1.5/data-access/entity-events.html#after-commit
This sample in the documentation also gives error. Is this a bug?
I have added @Transactional, but still there is error.
What is the best way to handle this?
Thanks
@TransactionalEventListener
void onCustomerChangedAfterCommit(EntityChangedEvent<Customer> event) {
try {
if (event.getType() != EntityChangedEvent.Type.DELETED
&& event.getChanges().isChanged("grade")) {
Customer customer = dataManager.load(event.getEntityId())
.joinTransaction(false)
.one();
emailCustomerTheirNewGrade(customer.getEmail(), customer.getGrade());
}
} catch (Exception e) {
log.error("Error handling Customer changes after commit", e);
}
}