openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <>
Subject Changing lifecycle state of StateManagers forcibly and dangerously
Date Wed, 07 May 2008 23:46:36 GMT

While exploring possibility to build a feature that allows migrating
instances/graphs from one database another, I needed to change the life
cycle state of a StateManager. 


-    private void setPCState(PCState state) {
+    public void setPCState(PCState state) {

Though the change is on implentation and not on the interface, I understand
that this is not a 'safe' change. And hence will like to hear some other way
to solve the following problem:

The way I approached the 'migration' problem is having a 'read' and a
'write' connection to two separate database -- and flush the StateManagers
to the target database. However, if the target database does not have the
instance the begin with, a PDIRTY StateManager (fetched from the 'source'
database) is  PNEW from the perspective of 'target' database. During 
StoreManager.flush(), forcefully changing lifecycle state to PDIRTY works as
a 'dirty' solution.

View this message in context:
Sent from the OpenJPA Developers mailing list archive at

View raw message