简体   繁体   中英

Grails domain class String property case insensitive 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 upper case, like this:

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

it no longer works. So I tried this:

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

but that doesn't work. Any suggestions? citizenship is a String property of class IndividualRecord .

这将使citizenship领域与'US'案例不敏感地匹配

def resultList = IndividualRecord.findAllByCitizenshipIlike('US')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM