如何在休眠中将参数传递给子查询?我正在尝试这个,但我得到一个例外,即 :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()