Is there an easy way using a library to facilitate the synchronization of two hibernate instances. One running locally on a client and one running on a central server exposed via a web service.
So Client tracks changes it makes, pushes them to the Server. The server ensures that the clients is not updating out of sync objects and stores the clients changes.
The Client can also sync with the Server so that it can see the changes made by other clients.
The idea is that the client can be run offline, without access to the server and only come online to synchronize when needed.
There is no ‘magical’ way of achieving it. You have to do something like this:
versionorlastModifiedfield for each entityids andversion. If the version on the server hasn’t been changed, delete them. If it has – decide for yourself whether to delete them or notversionfield. If there has been no modification on the server, persist the new entity. If there has been modification, there are a few options: