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.  
支持當前事務;如果不存在當前事務則拋出一個異常
發佈了11 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章