openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brill Pappin" <br...@pappin.ca>
Subject RE: Synchronizing two databases with the same model
Date Wed, 30 Apr 2008 23:11:40 GMT
Actually, the most obvious approach is not to write some special code, but
simply enable replication and don't worry about trying to get OJPA to sync.
What kind of database is it (most popular db's have replication of one sort
or another)?

- Brill Pappin

-----Original Message-----
From: Jonas Petersen [mailto:jonas@mindfloaters.de] 
Sent: Wednesday, April 30, 2008 3:25 PM
To: users@openjpa.apache.org
Subject: Synchronizing two databases with the same model

Hi there!

We have one data model and we need two datastores with that same data model.
Datastore A for editing and previewing and datastore B for production
(live).

Now we need to synchronize parts of datastore A to datastore B.

The most obvious approach would be: fetch objects from datastore A (and
possibly detach the objects) and then merge them in database B. But this
rises a couple of problems due to versioning / sequence generators /
optimistic locking / ...

e.g.:
- If objects (detached from datastore A) do not exist in datastore B, they
are assumed deleted and an exception is thrown
- Since we're using the GeneratedValue annotation for ids, objects would not
be able to get persisted in datastore B even if they were new.

Do you have any idea how to solve this problem in a regular way?

One (non JPA-)way would be to implement it with  native queries. Maybe this
is the only way? Would probably be harder to maintain though.

Thanks for any suggestion!

Regards
Jonas


Mime
View raw message