簡體   English   中英

無法混合JPA位置參數和本地Hibernate位置/常規參數

[英]Cannot mix JPA positional parameters and native Hibernate positional/ordinal parameters

我正在使用Hibernate / JPA執行本地PostGIS查詢。 這些查詢的問題在於它們需要的參數不是經典的X =“值”形式。

我的查詢是:-

@Modifying
@Query(value="UPDATE memo SET readMemo = true and updatedBy_id = ?1 and updatedBy = ?1 and updatedOn = ?2 where assignToUser_id = 1? and readMemo = false and deleted = false ",nativeQuery = true)
void readAllMenoByCurrentUser(Long id, Date updateTime);

錯誤:-

org.springframework.dao.InvalidDataAccessApiUsageException: Cannot mix JPA positional parameters and native Hibernate positional/ordinal parameters; nested exception is java.lang.IllegalArgumentException: Cannot mix JPA positional parameters and native Hibernate positional/ordinal parameters

有誰知道在這種情況下如何解決?

您有"1?" 在您的查詢中。 這意味着它將嘗試將其解釋為“?” (SQL參數)而不是位置參數。 將其更改為"?1"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM