eclipse complains about my JPA NamedQuery

eclipse complains about my JPA NamedQuery



For some reason eclipse IDE complains about my JPQL @NamedQuery



Input parameters can only be used in the WHERE clause or HAVING clause
of a query.



and



An association field cannot be used in an update items path
expression.



this is my query:


"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"



Any thoughts?



thank you very much




2 Answers
2



JPQL is not the best option for update statements, better to just update the object from the persistence context or use native query instead



If your JPA version is 2.0 or below, you can only use parameters is the WHERE clause.



It changes from version 2.1 and above, as you can see in the section 4.6.4 of the JSR 338: Java TM Persistence API, Version 2.1



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.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế