question:
When testing the rollback of atomikos multi-data source transaction, use throw new Exception("xxxx") to simulate system exception, and then the transaction has not been rolled back.
reason:
After a long time, I found out that using throw new Exception("xxxx") will not roll back,
But you can use throw new RuntimeException("xxxxxxxxxxxx"); to simulate system exceptions, so that atomikos multi-data source transactions will be rolled back!
Or write some code that cannot be executed normally to simulate system exceptions, such as: String a = null; a.toString();