【问题标题】:Default behavior of @Transactional annotation@Transactional 注解的默认行为
【发布时间】:2019-06-23 18:18:48
【问题描述】:

当我们在一个方法上写@Transactional 时,会自动触发哪种行为类型?以及它与其他行为有何不同。

行为类型,如传播、隔离、回滚、超时或只读

【问题讨论】:

  • 行为类型是什么意思?
  • 行为类型,如传播、隔离、回滚、超时或只读

标签: hibernate jpa spring-data-jpa


【解决方案1】:

默认传播是必需的:

默认值: org.springframework.transaction.annotation.Propagation.REQUIRED

隔离:

默认为 Isolation.DEFAULT。

所有信息都可以在 API Doc 中找到:

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html

还可以在官方文档中找到有关事务管理的更多信息:

https://docs.spring.io/spring/docs/5.1.7.RELEASE/spring-framework-reference/data-access.html#transaction-declarative

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-02
    • 2022-10-24
    • 1970-01-01
    • 2021-02-11
    • 2019-02-18
    • 2014-12-24
    相关资源
    最近更新 更多