1. The database engine does not support transactions
For example, in MySQL database, MyISAM engine does not support transaction operation, InnoDB does support transaction engine.Copy the code
2. Not managed by Spring
Transactions do not take effect when the class is not managed by Spring.Copy the code
3. Methods are not public
4. Self invocation problem
If a transaction is enabled at the upper layer and the transaction is enabled at the lower layer, the transaction at the lower layer does not take effect.Copy the code
5. The transaction manager is not configured for the data source
6. Transactions are not supported
Transactional @Transactional(Propagation = Propagation.NOT_SUPPORTED)Copy the code
7. The abnormality is eaten
If a catch exception is not thrown, the transaction will not take effect.Copy the code
8. The exception type is incorrect
Transactional rollbacks are runtime exceptions by default and throw exceptions of the wrong type. Annotation @Transactional(rollbackFor = exception.class) this configuration is limited to Throwable Exception classes and their subclasses.Copy the code