"NOT IN" with HQL and Grails
The following query should select all organisations that are not in the excludedOrgs
:
Organisation.findAll("from Organisation o where o not in elements(?)",
[excludedOrgs])
All I get is an org.springframework.orm.hibernate3.HibernateQueryEx开发者_StackOverflow社区ception telling me: expecting IDENT, found '?'
I'm using Grails 1.3.6.
What's wrong with my query?
both should work (as named and positional params are allowed)
Organisation.findAll("from Organisation o where o not in (?)", [excludedOrgs])
Organisation.findAll("from Organisation o where o not in (:excludedOrgs)", ["excludedOrgs":excludedOrgs])
精彩评论