持久层事务请求异常
当前线程没有实体管理器和可用的实际事务——不能可靠地处理“remove”调用
严重: Servlet.service() for servlet [dispatcher] in context with path [/layui-curd] threw exception [Request processing failed;
nested exception isorg.springframework.dao.InvalidDataAccessApiUsageException:
No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call; nested exception is javax.persistence.TransactionRequiredException:
No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call] with root cause
javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call
错误原因:
在做增删改操作的时候要在service层的方法上添加事务: @Transactional
本文详细解析了在进行数据增删改操作时遇到的持久层事务异常问题,强调了在service层方法上添加事务注解(@Transactional)的重要性,以确保在没有实际事务的情况下能够可靠地处理remove调用。
6445

被折叠的 条评论
为什么被折叠?



