天天看點

Spring的事務傳播特性

PROPAGATION_REQUIRED

Support a current transaction; create a new one if none exists.  支援一個目前事務;如果不存在,建立一個新的。

This is typically the default setting of a transaction definition, and typically defines a transaction synchronization scope.

這通常是預設設定事務的定義,通常定義了事務同步範圍。

PROPAGATION_SUPPORTS

Support a current transaction; execute non-transactionally if none exists. 

支援目前事務;如果不存在目前事務則執行非事務。

PROPAGATION_NOT_SUPPORTED

Do not support a current transaction; rather always execute non-transactionally. 不執行目前事務;而是總是執行非事務

PROPAGATION_REQUIRES_NEW

Create a new transaction, suspending the current transaction if one exists. 

建立一個新的事務,如果存在目前事務的話暫停(挂起)目前事務 。

PROPAGATION_NESTED

Execute within a nested transaction if a current transaction exists 

如果目前存在事務的話,執行一個嵌套的事務

PROPAGATION_NEVER

Do not support a current transaction; throw an exception if a current transaction exists. 

不支援目前事務;如果存在目前事務則抛出一個異常

PROPAGATION_MANDATORY

Support a current transaction; throw an exception if no current transaction exists.  

支援目前事務;如果不存在目前事務則抛出一個異常

繼續閱讀