簡體   English   中英

休眠中子查詢中的命名參數

[英]named parameters in a subquery in hibernate

如何在冬眠中將參數傳遞給子查詢? 我正在嘗試這樣做,但我得到一個例外,即:currentDate在(... [query] ...)中作為命名參數不存在,即使查詢中清楚地顯示了:currentDate

查詢看起來像

createQuery
(
    "from mymodel where someid = :modelId and otherKey not in 
    ( select c.otherKey from someOtherTable c where c.updateDate = :currentDate )"
)
.setLong(":modelId", someLongValue)
.setDate(":currentDate", new Date())
.list()

設置參數時請勿使用冒號。

q.setDate("currentDate", new Date());

暫無
暫無

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

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