Told you, we love sharing!
Following is an example of unidirectional one-to-many relationship: class Employee { String name static hasMany = [roles: Role] } class Role { String name } How can we find all the employees with a particular role – “Grails Developer”? Role role = Role.findByName(“Grails Developer”) One way of doing this can be: Employee.list().findAll{role in it.roles} This […]