Differences between requires_new and nested propagation in Spring transactions

前端 未结 3 1260
-上瘾入骨i
-上瘾入骨i 2020-12-07 14:33

I can\'t understand the behavior difference between the PROPAGATION_REQUIRES_NEW and PROPAGATION_NESTED propagation policies. It seems to me that i

3条回答
  •  醉梦人生
    2020-12-07 14:36

    Please find the difference

    1.) Use of NESTED Transaction
    

    Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else. Nested transaction is supporting by Spring

    2.)Use of REQUIRED Transaction Support a current transaction, create a new one if none exists. . It means for banking domain like withdraw,deposit, update the transaction

    3.) Use of REQUIRES_NEW Transaction Create a new transaction, and suspend the current transaction if one exists.

提交回复
热议问题