Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 64522 invoked from network); 7 May 2008 23:47:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2008 23:47:09 -0000 Received: (qmail 99556 invoked by uid 500); 7 May 2008 23:47:10 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 99534 invoked by uid 500); 7 May 2008 23:47:10 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 99523 invoked by uid 99); 7 May 2008 23:47:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 May 2008 16:47:10 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 May 2008 23:46:16 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JttLI-0002WN-S6 for dev@openjpa.apache.org; Wed, 07 May 2008 16:46:36 -0700 Message-ID: <17117083.post@talk.nabble.com> Date: Wed, 7 May 2008 16:46:36 -0700 (PDT) From: Pinaki Poddar To: dev@openjpa.apache.org Subject: Changing lifecycle state of StateManagers forcibly and dangerously MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ppoddar@apache.org X-Virus-Checked: Checked by ClamAV on apache.org 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. openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java - 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: http://www.nabble.com/Changing-lifecycle-state-of-StateManagers-forcibly-and-dangerously-tp17117083p17117083.html Sent from the OpenJPA Developers mailing list archive at Nabble.com.