简体   繁体   English

如果在内部@Spring注释了方法,则Spring @Transactional注释方法是否会覆盖@Transactional(readOnly = true)方法?

[英]Does a Spring @Transactional annotated method overwrite an @Transactional(readOnly=true) method if called within it?

In the name of reuse, I would like to call a method annotated with @Transactional(readOnly) from inside a method annotated with @Transactional with exclusive locking. 在复用的名字,我想调用带注释的方法@Transactional(readOnly)从标注有一个方法内@Transactional独家锁定。

Simply put, Will this overwrite the shared locking optimizations used for the readonly call? 简而言之,这会覆盖用于只读调用的共享锁定优化吗?

Depends on value of propagation you set for your outer transaction. 取决于您为外部交易设置的propagation价值。 All that explained really well in Spring documentation: 所有这些在Spring文档中都很好地解释了:

http://docs.spring.io/spring-framework/docs/4.0.x/spring-framework-reference/html/transaction.html http://docs.spring.io/spring-framework/docs/4.0.x/spring-framework-reference/html/transaction.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 弹簧靴。 @Transactional 方法调用 @Transactional(readonly=true) 方法 - Spring Boot. @Transactional method calling a @Transactional(readonly=true) method Spring 为在 @Transactional 注释方法中调用的每个 JpaRepository 方法打开一个新事务 - Spring opens a new transaction for each JpaRepository method that is called within an @Transactional annotated method 从Spring Boot测试调用的@Caching方法[注有@Transactional]无法正常工作 - @Caching method called from spring boot test [annotated with @Transactional] not working 从服务类中调用时,Spring @Transactional不适用于带注释的方法 - Spring @Transactional doesn't work for an annotated method when called from within service class 回滚 @Transactional 注释的方法 - Rollback a @Transactional annotated method Spring AOP:具有@Transactional注释方法的方法的注释切入点? - Spring AOP : Annotated pointcuts for a method with @Transactional annotated method? 当@Transactional(readonly=true) 方法调用@Transactional(readonly=false) 方法时会发生什么,反之亦然? - What happens when @Transactional(readonly=true) method calls @Transactional(readonly=false) method and vice versa? 从另一个@Transactional注释方法调用@Transactional注释方法 - Call @Transactional annotated method from another @Transactional annotated method 与方法注解者@Transactional的通信 - Communication to caller of method annotated @Transactional 方法上注释的 Spring @Transactional 是否确保在方法结束时准确刷新数据? - Does Spring @Transactional annotated on method ensure the flush of data exactly when the method ends?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM