java - Get an Exception from CDI transactional observer methods -
we can declare observer method transactional defining transactionphase attribute like:
public void ondocumentupdate(@observes(during=after_success) @updated document doc) { ... } is possible exception causes transaction broken within transactional cdi observers? example, i'd write business logic scenario based on exception thrown:
void ondocumentupdate(@observes(during=after_failure) @updated document doc) { exception e = getfailurecause(); if (check_wether_e_is_instance_of_constraintviolationexception) { // } } any ideas how achieve it? in advance!
consider using cdi interceptors handle exceptions.
Comments
Post a Comment