“不支持DML操作”用简单的UPDATE查询 [英] "Not supported for DML operations" with simple UPDATE query
本文介绍了“不支持DML操作”用简单的UPDATE查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用以下HQL时,出现错误不支持DML操作
...
@Query(UPDATE WorkstationEntity w SET w.lastActivity =:timestamp WHERE w.uuid =:uuid)
void updateLastActivity(@Param(uuid)字符串uuid, @Param(timestamp)时间戳timestamp);
什么可能导致这个问题?这看起来并不是一个常见的错误,因为我在Google中发现了一些结果。
解决方案检查帖子< hibernate用户论坛中的hibernate hql ERROR:不支持DML操作。
hibernate =https://forum.hibernate.org/viewtopic.php?p=2465847
您可能称为
querySt.list();
为您的 UPDATE
查询。相反,您应该调用
querySt.executeUpdate();
I'm getting the error Not supported for DML operations
when I use the following HQL...
@Query("UPDATE WorkstationEntity w SET w.lastActivity = :timestamp WHERE w.uuid = :uuid")
void updateLastActivity(@Param("uuid") String uuid, @Param("timestamp") Timestamp timestamp);
What could be causing the issue? It doesn't seem to be a common error given the few results I've found in Google.
解决方案
Check the post hibernate hql ERROR: Not supported for DML operations in the hibernate users forum.
Most likely you called
querySt.list();
for your UPDATE
query. Instead you should call
querySt.executeUpdate();
这篇关于“不支持DML操作”用简单的UPDATE查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文