今天写了个删除的方法是 关联多表删除
写在 service的 但是抛出了以下异常
No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call经过面向百度学习得知。原来多表删除 是需要加上事务注解的,因为springboot 觉得 多表删除不加事务是不安全的
最后 在service 相关方法上添加 @Transactional 解决了这个问题
这个注解是
import org.springframework.transaction.annotation.Transactional;包下的
发表评论 取消回复