码迷,mamicode.com
首页 > 编程语言 > 详细

Very important notes about Spring @Transnational(Srping事务注解 @Transnational重要注意事项)

时间:2019-07-14 18:09:46      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:calling   about   pre   upd   exce   down   except   注意   int   

Sprint @Transnational is being ignored in the following cases:

1. when the caller method is calling the @Transaction annotated method from the same class

2. When the Annotated method is not public

@Transnational by default don‘t rollback for Checked Exceptions


class A{
     void caller(){
            doInTransactionMethod(); // @Transnational is ignored
     }

    @Transnational // by default rollback for RuntimeExceptions
    public <return type> doInTransactionMethod(<params>){ // should be public as well
    }
}

 



The problem is, I keep forgetting about the above 3 simple rules, So I tried to writing down here to try not to forget about it

 

http://m-hewedy.blogspot.com/search?updated-max=2019-01-01T07:27:00%2B02:00&max-results=7

Very important notes about Spring @Transnational(Srping事务注解 @Transnational重要注意事项)

标签:calling   about   pre   upd   exce   down   except   注意   int   

原文地址:https://www.cnblogs.com/passedbylove/p/11184854.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!