Wycofaj metodę @ Adnotacja transakcyjna
Dobry dzień. Poniższy kod:
class A{
private B b;
@Transactional
public SomeResult doSomething(){
SomeResult res = null;
try {
// do something
} catch (Exception e) {
res = b.saveResult();
}
return res ;
}
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
class B{
public SomeResult saveResult(){
// save in db
}
}
Jak rozumiem, jeśli istnieje wyjątek w metodziedoSomething
transakcja nie jest wycofywana. I jak sprawić, żeby się toczył? i zwrócił SomeResult