By using the CreateCriteria, I want to compare two lists and check if there are at least one element in groups
present in users
.
Is there something like eq
to perform that?
Domain
class User {
String login
static hasMany = [groups = String]
}
class Project {
String name
static hasMany = [users = User]
}
CreateCriteria
def UserInstance = User.get(1)
def idList = Project.createCriteria().list () {
projections { distinct ( "id" )
property("name")
property("id")
}
eq("users.login", UserInstance.groups) //check if there are at least one element in groups list present in users list.
order("name","desc")
}