Spring @Transactional method - participating transaction

前端 未结 3 1876
离开以前
离开以前 2020-12-10 18:23

in one dao I have 2 @Transactional methods.

if i do not provide any explicit properties,

then what will happen, if

I run one method in the body of an

3条回答
  •  鱼传尺愫
    2020-12-10 18:27

    The default value of the propagation attribute of @Transactional is REQUIRED, which means:

    Support a current transaction, create a new one if none exists.

    So yes - both methods will run in the same transaction.

    But one important advice: don't make your DAO transactional. The services should be transactional, not the DAO.

提交回复
热议问题