@Transactional method calling another method without @Transactional anotation?

前端 未结 4 1762
故里飘歌
故里飘歌 2020-12-02 05:16

I\'ve seen a method in a Service class that was marked as @Transactional, but it was also calling some other methods in that same class which were not marked as

4条回答
  •  醉酒成梦
    2020-12-02 05:36

    @Transactional marks the transaction boundary (begin/end) but the transaction itself is bound to the thread. Once a transaction starts it propagates across method calls until the original method returns and the transaction commits/rolls back.

    If another method is called that has a @Transactional annotation then the propagation depends on the propagation attribute of that annotation.

提交回复
热议问题