报错:
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [delete from cn.lzh.springdata.pojo.Student s where s.studentName=:studentName]; nested exception is java.lang.IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [delete from cn.lzh.springdata.pojo.Student s where s.studentName=:studentName]
解决方法:
springdata中接口方法中注意要打上注解:
@Transactional
//事物
@Modifying
//对DML支持
本文解决了在使用SpringData JPA进行DML操作时遇到的InvalidDataAccessApiUsageException异常,详细介绍了如何通过添加@Transactional和@Modifying注解来正确执行删除操作。

489

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



