发布于 2年前

Spring JPA报错:Not supported for DML operations

在一个Spring JPA项目中,执行更新或删除是报错:

Not supported for DML operations

解决方法:只需要添加注解@Modifying即可。

@Modifying
@Query(value = "update User user set user.address = :address where user.id = :id ")
void updateUserAddress(@Param("id") int id,@Param("address") String address);
©2020 edoou.com   京ICP备16001874号-3