我正在尝试执行此查询:
@Modifying
@Transactional
@Query(value = "UPDATE SpreadsheetRegisters r SET r.buApprobation =1 WHERE r.idRegister IN (:list)")
public void updateExpiredRegistries(@Param("list") List<BigDecimal> expiredRegistriesIds);
基本上,如果她的ID在该列表内,我将尝试更新该实体。
这是我得到的例外:
o.h.engine.jdbc.spi.SqlExceptionHelper : ORA-00936: missing expression
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement
似乎我的查询有误,但我不知道在哪里... 有人可以帮助我吗?
答案 0 :(得分:0)
在使用查询注释时,您的实体类必须称为“ SpreadsheetRegisters”。但是,如果要使用数据库表名而不是实体类名,则可以将@Query的native属性设置为true。
可以保留括号,放下它们。
答案 1 :(得分:0)
谢谢你们的支持。几个小时后,我发现了错误。该查询是正确的,但我的清单没有,她是空的,因此该数据库无法完成他的工作。
JPA:1 我:0