I have a @Service class that has an @Transactional method that calls another @Transactional method in the same class. I tested the rollback behavior for this, and I found that it was not working correctly. The code looks something like this:
@Service public class DefaulService implements ervice { @Transactional public void methodOne() { methodTwo();
After running the One method, I check the database and the changes there, although "JDBCTransaction - rollback" is displayed in the log.
If I call the Two method individually and add an exception at the end of it, the changes will be discarded correctly.
Is there a way to make the One methods the correct rollback changes that occurred during a @Transactional nested call? I had the impression that the default distribution of REQUIRED would achieve this, but it does not seem to work. Thanks
UPDATE
Ok, I just noticed something else. Right before throwing an exception, I call dao services and perform a manual update through 'executeUpdate'. If I comment on this line, nested rollback works. So it seems that the problem is actually causing the DAO and triggering an executeUpdate request. But shouldn't this also be done inside the current transaction?
Jaypea
source share