Hello!
My project is camunda, spring boot and JPA.
I have 2 java delegates via delegates expression.
Both delegates in one camunda transact borders.
First:
@Log4j2
@Transactional
@Component
public class First implements JavaDelegate {
final SomeRepository someRepository;
public First(SomeRepository someRepository) {
this.someRepository = someRepository;
}
@Override
public void execute(DelegateExecution execution) throws Exception {
try {
//successful do something with someRepository
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new BpmnError(this.getClass().getSimpleName(), e.getMessage());
}
}
}
Second:
@Log4j2
@Transactional
@Component
public class Second implements JavaDelegate {
final SomeRepository someRepository;
public Second(SomeRepository someRepository) {
this.someRepository = someRepository;
}
@Override
public void execute(DelegateExecution execution) throws Exception {
try {
//do something with someRepository and catch Exception
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new BpmnError(this.getClass().getSimpleName(), e.getMessage());
}
}
}
If I catch rollback in second delegate, how can I rollback first delegate?
Is it possible in this case?