I have:
static hasMany = [
services:String,
tags:String
]
I need to search the database for services.
This is the JSON for services
"services":["tid.2","tid.3"]
If services was a String (service) and not a hasMany String then tbis works
def inUse = ServiceTemplate.findAllByName(serviceTemplateInstance.service).size() > 1
How can I do this with services?
I’ve tried
def c = ServiceTemplate.createCriteria()
def results = c.list { eq('services', 'tid.2') }
but no luck…
You can use HQL instead. For example: