Is Spring @Service transactional?

别等时光非礼了梦想. 提交于 2019-12-11 23:19:37

问题


When I am on a spring service and I want to update several database tables through spring repositories, do I need to add @Transactional to make sure I am transactional and rollback or is it already there? If yes, do I need to add it to the class level or method?


回答1:


The answer is Yes, you need to add it separately. For more details, please refer:

What is the difference between defining @Transactional on class vs method

and

Spring - @Transactional - What happens in background?

and

https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/transaction.html#tx-decl-explained



来源:https://stackoverflow.com/questions/50833029/is-spring-service-transactional

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!