持久层事务请求异常
当前线程没有实体管理器和可用的实际事务——不能可靠地处理“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