我正在尝试在spring-jpa界面中添加@Modifying
方法,其中包含以下内容
@Modifying
@Transactional
@Query("update Contact cc set cc.bar=?2 where cc.foo = ?1 AND cc.createdTime>CURRENT_TIMESTAMP - interval '60' minute")
public Contact setFixedBarFor(String foo, boolean bar);
但我得到以下异常,..
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: interval near line 1, column 136 [update Contact cc set cc.foo=?2 where cc.bar = ?1 AND cc.createdTime>CURRENT_TIMESTAMP - interval '20' minute]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:288)
注意: 以下作品:
update Contact cc set cc.bar=?2 where cc.foo = ?1 AND cc.createdTime>CURRENT_TIMESTAMP
update Contact cc set cc.bar=?2 where cc.foo = ?1 AND cc.createdTime>CURRENT_TIMESTAMP-1
我想要算术内置,而不确定它是什么,我做错了。