[英]How to write OrientDB update query with Spring Data
I have repository and update method: 我有存储库和更新方法:
public interface TestRepo extends OrientObjectRepository<Test>
{
@Query("UPDATE Test t SET t.a = :a WHERE t.b = :b")
void updateTest(
@Param("b") String b, @Param("a") int a);
}
If I run this update method and I get IllegalArgumentException
. 如果运行此更新方法,并且得到
IllegalArgumentException
。 Most likely my query is incorrect for OrientDb. 我的查询很可能对OrientDb不正确。 So is there any tutorial how to write update query with Spring Data?
那么,有没有教程如何使用Spring Data编写更新查询?
You could try to change your query in this way (by removing the t
variable): 您可以尝试通过以下方式更改查询(通过删除
t
变量):
UPDATE Test SET a = :a WHERE b = :b
EDITED 已编辑
you can try to add @Modifying(clearAutomatically = true)
in this way: 您可以尝试以这种方式添加
@Modifying(clearAutomatically = true)
:
@Modifying(clearAutomatically = true)
@Query("UPDATE Test t SET t.a = :a WHERE t.b = :b")
void updateTest(
@Param("b") String b, @Param("a") int a);
Hope it helps 希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.