This is a simplified example of the real system.
My problem arises when I need to update
ClassA objects because I need to check if the modified object has more
ClassB objects or less and then update the
ClassA table and add, update or delete corresponding rows from
ClassCObjectsPerClassAObject tables. So my approach was to keep the original object unmodified in the persistence layer until the modified object comes back from the interface and then compare them, but with this approach, all objects need to be duplicated. Is there a better approach, method, or design pattern that I can use for this kind of problem?
I'm using Python with SQLAlchemy and MySql in the persistence layer, flask in the services layer, and Angular in the frontend