Reprint please indicate the source: https://blog.csdn.net/jxz999000/article/details/91041798 the Spring transaction failure is mainly caused by two aspects: 1.Service class inside the method call, 2.try ... catch throw checked exceptions .
The first case corresponds to get service class method calls as follows :( add a field length of the first parameter corresponding to the complementary database to add method 50)
Resolve as follows:
Summary, called Method A Method B, in fact, is quoted by "this", which is a direct call to a target class, not proxy classes obtained by the Spring context, so the transaction will not open.
The second situation is as follows:
Reason: exception RuntimeException or its subclass, so that the transaction will be rolled back (by default, Error will cause a rollback) transaction thrown. But in truth there are many exceptions RuntimeException class and not the slightest relationship
Solutions are as follows: