I have 2 domainClasses as below :
class Customer {
def name
static hasMany = [accounts:Account]
}
class Account {
def accountNo
def type
}
Here Account's type can be 'Saving','Current','FD'
I want to write a criteria to search all those customers who have account types 'Saving','Current'.
What should be the criteria, I tried using below :
def customers = Customer.createCriteria().list {
accounts {
and {
eq('type','Saving')
eq('type','Current')
}
}
}
But when it executes it create inner join which is giving 0 result.