We are facing issues in updating a record in MySQL when the CDT has a reference

Certified Senior Developer
We are facing issues in updating a record in MySQL when the CDT has a reference of OneToMany foreign key reference. When we update the parent record, it is updating it but for the child CDT it is removing the existing record from DB and adding only the new values passed to it as a new row, without keeping the old records(which are also foreign key references for the same data) which were supposed to be there.
CDT1 - field1, field2, field3, field4(which is a foreign key ref with OneToMany).
Now when we update the CDT1 records, it is removing the existing record of field4 and add the values we currently pass to the CDT of field4.
Also when we pass the field4 data with all existing records, it is reinserting them as new rows still deleting the old ones.
Attached is the parent CDT structure.

SCS_RMA_CUSTOMER_PARTS.xsd

OriginalPostID-195796

OriginalPostID-195796

  Discussion posts and replies are publicly visible