Spring data jpa 自定义SQL语句遇到错误Not supported for DML operations
来源:互联网 发布:产品在淘宝没有展现 编辑:程序博客网 时间:2024/06/07 23:08
今天在自定义一个Update语句时运行遇到一个错误,显示Not supported for DML operations 也就是说不支持DML操作。我的UserRepository是继承的PagingAndSortingRepository接口,在看了JPA的文档之后,发现此接口不支持update事务,所以需要在注解上添加@Modifying。
以下是我的源码:
@Modifying
@Query("update User u set u.u_name=?2,u.u_sex=?3,u.u_date = ?4,u.u_minzu = ?5,u.u_area=?6,u.u_country=?7 where u.u_id =?1")
public void updateUserById(String u_id,String u_name,String u_sex,
String u_date, String u_minzu,String u_area,
String u_country);
以下是我的源码:
@Modifying
@Query("update User u set u.u_name=?2,u.u_sex=?3,u.u_date = ?4,u.u_minzu = ?5,u.u_area=?6,u.u_country=?7 where u.u_id =?1")
public void updateUserById(String u_id,String u_name,String u_sex,
String u_date, String u_minzu,String u_area,
String u_country);
0 0
- Spring data jpa 自定义SQL语句遇到错误Not supported for DML operations
- 学习Spring JPA时报的Not supported for DML operations 错误
- org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations
- Spring Data之@Query中的org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML
- Spring Data之@Query中的org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML
- Not supported for DML operations [ UPDATE ltd.miku.xxx.xxx SET xxxxxxx
- Spring Data Jpa自定义sql查询返回
- Spring Data Jpa 使用@Query标注自定义查询语句
- Spring Data JPA配置出现Not a managed type错误
- Using INSTEAD OF triggers in SQL Server for DML operations
- Using INSTEAD OF triggers in SQL Server for DML operations
- spring data jpa 自定义接口
- Spring Data JPA 自定义查询
- Spring-data-jpa常见错误
- Spring-Data-JPA 错误总结
- spring data jpa 执行sql
- 动态SQL-Spring Data Jpa
- Spring data jpa Supported keywords inside method names
- Hrbust 1491 游河【最大流模板题】
- Codeforces Round #366 (Div. 2) C. Thor
- Android使用SharedPreferences实现本地轻量存储,ToggleButton,TextView边框详解
- 基于matlab实现图像的直方图均衡
- eclipse在ubuntu16.04下cpu占用率高的问题
- Spring data jpa 自定义SQL语句遇到错误Not supported for DML operations
- C++ 操作Excel问题
- Python pickle
- hash素数表(备用)
- manacher算法
- Mysql同时执行多个select语句——union
- Portal for ArcGIS发布SPK三维场景可能遇到的问题---持续更新
- 欢迎使用CSDN-markdown编辑器
- POJ 2663 Tri Tiling