[SOLVED] @Transactional – rollback on Exception not working


I am using aurora mysql for one of my project, wanted to rollback db update in update2 method in case of any exception.

If I add transaction on update, getting this error Access denied for user ‘root’@’localhost’ (using password: NO). Without transactional annotation, I’m able to perform db operation, there is no issue with credentials.

sudo code:

class operation {
    @Transactional(rollbackFor = Exception.class)
    public void update() {
    public void update2() {
        serverupdate(); >> throws exception.

Can someone suggest possible cause? Thanks.


I found that datasource being used for @Transactional and crud operations were different which was causing issue. for @Transactional default dataSource of application were being used where as for crud, we defined different dataSource.

Answered By – Katha patel

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *