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, 07 May 2008 23:42:54 GMT
I haven't really been following the thread, but...
I just thought of an old project that might still be active... 
Something called CJDBC which was an early attempt to provide a driver level
replication, cluster and fail-over feature.

If it's still around, it might be able do your replication.

A quick search pulled up this, which has a news item for May 2008, so it
looks like its still active
http://c-jdbc.objectweb.org/

- Brill

-----Original Message-----
From: Pinaki Poddar [mailto:ppoddar@apache.org] 
Sent: Wednesday, May 07, 2008 3:28 PM
To: users@openjpa.apache.org
Subject: Re: Synchronizing two databases with the same model


Hi,
> 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 / ...

  Another alternative approach is to consider is a single StoreManager with
two database connections: one is 'read' connection to 'source' database and
the other is 'write' connection to 'target' database. The JPA EntityManager
interface remains intact but, below the hood, all 'read' operations happen
on 'source' database while any modification is written to target database. 

  I prefer this approach because then all the instances are managed by the
same persistence context; rather than being realized in one context,
detached and then merged onto another. Also the 'migration application'
becomes simple. One can issue a query, dirty all the selected instance and
then commit. The effect will be migrating all the selected objects from the
'source' database to 'target' database.
   

  Now OpenJPA Slice module already has some support to handle multiple
databases in a same persistence context. I tweaked Slice a bit to get the
'migration' feature as described above.  

  If you are interested to explore this further, let me know.


--
View this message in context:
http://www.nabble.com/Synchronizing-two-databases-with-the-same-model-tp1698
9856p17112416.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message