实现删除的接口的,调用deleteOneById 是没问题的,但是用自定义的函数就出问题了,有道友帮我看看是哪里出问题了?代码如下
(感觉没有啥地方跟大锯个的代码不一样)

错误提示为下面
[org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query] with root cause
javax.persistence.TransactionRequiredException: Executing an update/delete query
这话说得有多违心呀!
没有啥地方不一样
其实你那么写也没错。
错在你调用的服务没有加事务注解就去更新数据了
你应该在服务类加这个注解。
@Transactional