I have the domain classes as shown below
class College implements Serializable
class Student implements Serializable
And I have UpdateStudent action in StudentController, which accepts Student object and updates the data in MySQL database, the problem I'm facing is the foreign key "College" is getting updated too along with "Student", which is undesirable, I just want Student object to be updated ignoring the foreign keys.
As a workaround I'm using
in the action, which fetches college object from database and ignores the college object in student, but with big codebase it is difficult to call refresh() on college object everywhere. How can I address this problem?
I'm using Grails 3.
Sample Student Object
"description": "Test description"
Here the contents of the college object should not be updated when I update Student object.