Sobes.tech
Junior — Senior

Analysis of the impact of nested calls on transactions

livecode

Task condition

The controller initiates a call to the doA() method from the ServiceA service. What changes will be recorded in the database?

@Service
public class ServiceA {

    @Autowired
    private ServiceB serviceB;

    @Transactional
    public void doA() {
        try {
            serviceB.doB();
        } catch (Exception ex) {

        }
    }
}

@Service
public class ServiceB {

    @Transactional
    public void doB() {
        if (true) {
            throw new IllegalStateException();
        }
    }
}