问题
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