@Transactional Transaction common scenarios
1> Not in interface Statement above @Transactional, belong class The specific method of using @Transactional.
2> If @Transactional Add to class On , be class All the methods in will have transactions , Including query methods , This has an impact on performance .
3> In the same class , Method A No transaction declared , Method B Declared the transaction , Method A The method is used in B, External call method A when ,B It doesn't work .
4>@Transactional Can only be used in public The way to decorate , Use in protected、private Invalid on , because @Transactional The modified method will not take effect until it is called externally .
5> Throw the following exception , The transaction rolls back ：
5.1>XXXException, Transaction rollback
5.2> In the child thread ,execute The method is to add @Transactional, You can roll back ; Indirect invocation , No rollback .