出于某种原因,Eclipse IDE 提示我的 JPQL @NamedQuery
Input parameters can only be used in the WHERE clause or HAVING clause of a query.
和
An association field cannot be used in an update items path expression.
这是我的查询:
"UPDATE ereturn er " +
"SET " +
"er.shipper = :shipper, " +
"er.consignee = :consignee, " +
"er.notes = :notes, " +
"er.pickupDateTime = :pickupDate, " +
"er.productItems = :productItems, " +
"er.returned = :returned, " +
"er.returnMethod = :returnMethod, " +
"er.rma = :rma, " +
"er.scanDateTime = :scanTime, " +
"er.status = :status, " +
"er.dispatchedDate = :dispatchedTime, " +
"er.barcode = :barcode, " +
"er.groupName = :groupName " +
"WHERE er.id = :id"
有什么想法吗?
非常感谢
最佳答案
如果您的JPA版本是2.0或以下,则只能使用WHERE子句参数。
它从 2.1 及更高版本开始发生变化,正如您在 JSR 338: Java TM Persistence API, Version 2.1 的 4.6.4 节中看到的那样
Input parameters can only be used in the WHERE clause or HAVING clause of a query or as the new value for an update item in the SET clause of an update statement.
关于java - eclipse 提示我的 JPA NamedQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52231001/