In Grai开发者_StackOverflowls, with DynamicFinder how can we execute a query using ilike along with inList? Or can we use CriteriaBuilder to combine ilike and inList? Thank you!
why do you want do combine ilike and inList? InList is a constraint and defined as follows http://www.grails.org/doc/latest/ref/Constraints/inList.html. So your attribte with this constraint can only hold data defined in this list. e.g.
name(inList:["Frey", "Fred", "Flip"] )
Test.createCriteria.list {
like("name","F%")
}
Build query on the fly:
def filter = ['a', 'bb', 'c']
def res = DomainClass.withCriteria {
or {
filter.each {
ilike('property', "%$it%")
}
}
}
精彩评论