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.