Is it possible to use an 'in'
criteria in a Grails DetachedCriteria?
This is what I have,
def query = new DetachedCriteria(DomainObject)
// list is actually built up from another query,
// but for this example I will use a predefined list
query.where { 'in' 'id', [4L, 5L, 9L] }
def count = query.count()
What I am seeing is that the count, which you would expect to be 3, is actually just the entire DomainObject table.
How do I get this query to work?
Try assigning the result of where to a query:
query = query.where { 'in' 'id', [4L, 5L, 9L] }