参考地址:
http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/config/EnableJpaRepositories.html#enableDefaultTransactions--
public abstract boolean enableDefaultTransactions
Configures whether to enable default transactions for Spring Data JPA repositories. Defaults to true. If disabled, repositories must be used behind a facade that's configuring transactions (e.g. using Spring's annotation driven transaction facilities) or repository methods have to be used to demarcate transactions.
Returns:
whether to enable default transactions, defaults to true.
Default:
true
原来是在spring配置文件中关闭了jpa默认的事务管理机制
<jpa:repositories base-package="com.xx.order"
		enable-default-transactions="false" />

 需要手动开启,所以,用spring的annotation在方法或类里面开启------------------(用@Transactional)

相关文章:

  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-12-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-11-08
  • 2022-01-19
  • 2021-04-26
  • 2022-12-23
相关资源
相似解决方案