Grails is a fabulous light weight framework that operates by convention over configuration. This mode of operation results in significant developer productivity and a decrease in configuration headaches. However, Grails conventions sometimes yield subtle unwanted results. One example is the default one to many unidirectional mapping configuration, in a very specific scenario. Grails maps the one to many relationship with a join table. This results in a problem when deleting the child when calling delete() on a child object.
One to Many Mapping Unidirectional Default
When mapping two objects with a one to many relationship and making that relationship unidirectional, grails provides a simple default way to map this to the database. Take an example of Company and Employee. A Company can have many Employees. Here is a code snippet of how to map these objects.