开发者

named parameters in a subquery in hibernate

how can I pass a parameter to a subquery in hibernate? I am trying this but I get an exception that :currentDate does not exist as a named parameter in (...[query]...) even though the query clearly shows :currentDate in it

The query looks like

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()


Don't use colons when you set parameters.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜