'How to rollback if data save/update is failed in anyone database in spring boot?

I need to save/update data into two different database (oracle & db2). If data save failed in anyone database, it should rollback the data in other database. I am using spring boot 2.6.6. After some research i planned to use chainedTransactionManager. But it is deprecated. do we have any other way to achieve my scenario ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source