使用Spring Data JPA报错:javax.persistence.TransactionRequiredException: Executing an update/delete query
Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1496)
1、 报错原因:SpringData JPA事务导致的异常
2、解决:在Service层添加注解@Transactional
进行事务管理