What is the syntax for GORM withCriteira clause for query data that is an array of enums?
I can see how a static in clause is used with the GORM query criteria ( reference grails-gorm-in-criteria )
Person.withCriteria {
'in'("holderAge", [18..65] )
}
But what is the syntax for passing the data range into the clause using an array of enums?
enum ColorType {
RED(1),
BLUE(2)
}
def selectedColorTypes = [ ColorType.RED, ColorType.BLUE ]
class MyClass {
static hasMany [ colors: colorTypes ]
...
}
myList = MyClass.withCriteria {
'in' ( 'colors', selectedColorTypes )
}
This produces the error "Missing IN or OUT parameter at index :: 1"
What is the correct way of passing selectedColorTypes into the withCriteria?