implmenting 1 to n mapping for ORM c++
- by karan
I am writing a project where i need to implment a stripped down version of an ORM solution in c++. I am struck in implmenting 1-n relationships for the same.
For instance, if following are the classes:
class A
{
}
class B
{
std::list _a_list;
}
I have provided load/save menthods for loading/saving to the db.
Now, if i take the case of B :
Say , for the following workflow :
1 entry from _a_list is removed
1 entry from _a_list is modified
1 entry is added to _a_list
Now, i need to update the db using something like "b.save()".
So, what would be the best way to save the changes,i.e, identify the additions, deletions and updations to _a_list.