I've been working with grails for some months and now I understand better how it works and how things should be done, but I still have some doubts with GORM relationships.
Until know this is the way we make the relations:
We haven't used this one too much, but I think is the recommended one for this kind of relations.
static hasOne = [localizacion:Localizacion]
I have some doubts with this type of relationships. Is the belongsTo mandatory? If not, when should it be used?
What I've read is that setting the belongsTo property allows deletes to be cascaded and without it, saves and updates are cascaded but not deleted. Am I wrong?
We have used this kind of relationships, but creating or own join table because we needed to add some properties to the relation.
I think that to let grails manage this relationship you'll need just to set hasMany in both sides and maybe a belongsTo in one of the sides, but I don't have this too clear.
Anyone could send some examples on how to use it? Also I would want to know if our way of making this relationship (two one-to-many relationships) is ok or not.
If someone could suggest me the best way to make all the types of the relationships it would be great.
P.S. I have read the documentation but still have some doubts...