Grails Domain Class Invalid String Search

I am trying to find records in my database using my service and this works:

def resultList = IndividualRecord.findAllWhere(citizenship: 'us')

      

but when i change citizenship to uppercase like so:

def resultList = IndividualRecord.findAllWhere(citizenship: 'us')

      

it doesn't work anymore. So I tried this:

def resultList = IndividualRecord.findAllWhere(citizenship.caseIgnoreEquals('us'))

      

but that won't work. Any suggestions? Citizenship is a property of a String

class IndividualRecord

.

+3


source to share


1 answer


This will match the field citizenship

in case of case 'US'

insensitive



def resultList = IndividualRecord.findAllByCitizenshipIlike('US')

      

+3


source







All Articles