spring事务传播级别(枚举项意义)

spring事务的传播级别不知道可就尴尬了

(Propagation,一个枚举类)

1.REQUIRED(TransactionDefinition.PROPAGATION_REQUIRED),默认级别,

Support a current transaction, create a new one if none exists. 支持当前事务,不存在就创建新的

2.SUPPORTS(TransactionDefinition.PROPAGATION_SUPPORTS),

Support a current transaction, execute non-transactionally if none exists.支持当前事务,不存在就以非事务方式运行

3.MANDATORY(TransactionDefinition.PROPAGATION_MANDATORY),

upport a current transaction, throw an exception if none exists.支持当前事务,没有就抛出异常

4.REQUIRES_NEW(TransactionDefinition.PROPAGATION_REQUIRES_NEW),

Create a new transaction, and suspend the current transaction if one exists.创建新的事务,当前事务存在则挂起

5.NOT_SUPPORTED(TransactionDefinition.PROPAGATION_NOT_SUPPORTED),

Execute non-transactionally, suspend the current transaction if one exists.以非事务方式运行,当前事务存在则挂起

6.NEVER(TransactionDefinition.PROPAGATION_NEVER),

Execute non-transactionally, throw an exception if a transaction exists。非事务方式运行,有事务抛异常

7.NESTED(TransactionDefinition.PROPAGATION_NESTED);

Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else.

在嵌套事务内运行,很像PROPAGATION_REQUIRED

你可能感兴趣的:(Java,spring)