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
. Most likely my query is incorrect for OrientDb. So is there any tutorial how to write update query with Spring Data?
You could try to change your query in this way (by removing the t
variable):
UPDATE Test SET a = :a WHERE b = :b
EDITED
you can try to add @Modifying(clearAutomatically = true)
in this way:
@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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.