Whether ownership should be indicated depends on the type of reference action you want.
If you want Grails to do On Delete, CASCADE reference action, then DO indicate ownership. If you want Grails to do On Delete, the RESTRICT reference action, then DO NOT specify sortTo.
eg.
// "belongsTo" makes sense for me here. class Country { String name static hasMany = [states:State] } class State { String name; // I want all states to be deleted when a country is deleted. static belongsTo = Country } // Another example, belongsTo doesn't make sense here class Team { String name static hasMany = [players:Player] } class Player { String name // I want that a team should not be allowed to be deleted if it has any players, so no "belongsTo" here. }
Hope this helps.
Deepak mittal
source share