I am a zygote groovy programmer, and would like to know how to implement the following in groovy:
1- - Updating a Listing should not update the seller's information.
2- - Updating a seller's information should not modify any properties of that seller's listings
In order to implement aforementioned requirements I looked into groovy docs and found out that belongsTo will serve my purpose. However, I am not sure if belongsTo makes sense in the Listing class because it enforces the "Composition" relationship with Customer. Am I on the right track??
I'm not sure why you think that belongsTo has any impact on your 2 requirements. All you're doing with belongsTo and hasMany is defining the relationship and possibly, the cascading effect of those relationships. You've also obviously not tried this or written any tests otherwise, you would have found out that your syntax is wrong. belongsTo and hasMany are either lists or maps. Not closures.
My apologies, I made mistake while copying the code snippet. Yes you were right about the belongsTo and hasMany, this part is clear to me now thanks for that. The only part that I am still trying to figure out is where to look to implement the requirements. Can I get some pointers or references??