参考地址:
http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/config/EnableJpaRepositories.html#enableDefaultTransactions--
public abstract boolean enableDefaultTransactions
- 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)