Hello!
I'd like to know which type of exceptions are thrown inside methods which are @Transactional - that means which one I may catch inside the procedure and which one are forwareded to the caller. In other words, which type of exceptions may occour when the commit operation is performed.
Currently I catch all DataAccessException, HibernateException and TransactionException via an AOP proxy. But now, I need to handle occuring exceptions inside @Transactional annotated methods. If for example one of many persists inside the method fails, the legacy business logic must not be performed.
I'm not sure when some of these exceptions are thrown - for example when an invalid persist is performed.
Let me give you a simple example what I want to do:
Code:
@Transactional
void transactionalMethod() {
try {
persist(Entity);
doSomething(); //this method should be only invoked when the prevoius persist succeeds
}
catch(xxxException e) { //which exceptions can be catched here and are not dependent on the transaction mechanism
doSomethingDifferent();
}
}
void main() {
try {
transactionalMethod();
}
catch(xxxException e) {
//which exceptions come here and cannot be catched inside "transactionalMethod"
}
}
I think a TransactionException is thrown and catched outside the "transactionalMethod" but I'm not sure about the other exceptions.
I would really appreciate some help for this issue.
Thanks!
-meisterlampe