I have many entities associated to each other and I presented them in one form. User submit the form and admin approve or reject it, let’s say the form approved and user want to update his information. How this could be happen without losing the old data. Do the duplication of the domain model will solve the issue? and how it could be done?
Nada Juma Albahri
There are various ways to solve this depending on your needs. One way could be to make two associations: a 1-1 association for the most recent version of the entity, and a 1-* association for the history of the entity. Then, if the user makes changes, you:
Remove the “most recent” association from the old object and set it to the “history” association
Create a new object with the changes and set that to the “most recent” association
That way you can always retrieve earlier versions if you want to.