java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead

java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead
java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead
环境说明:
该异常出自JPA的事务
产生此异常的原因是因为在项目中将JPA的事务交给spring来管理,即使用了@Transactional注解,而自己手动又在代码中开启了JPA的事务.
解决方案:删除自己手动写的JPA事务代码或去掉@Transactional注解

你可能感兴趣的:(java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead)