The scenario is somehow complicated but the abstract is:
We have a client/server application but client is not always connected to server, so clients have their own DBMS. We have used hibernate and MySQL for client-side. The data in client and server is synced each time the user
does the synchronization.
For example suppose we have had a Class A in server (a record in
database), after synchronization this database record is sent to client
and it is persisted by Hibernate. In the next synchronization if A has been
updated, the newer version with all of its dependents (children) will be sent
to client. So those children which do not exist in the new children set,
should be removed and new children must be added to A. But sometimes
because of some DB constraints it causes problems, so I had to remove
children of older version explicitly and then add new children.
I hope I explained the problem clear enough.
Thanks Farzad (Mamnoon)
|