From 09e7aab7778db72e6412625f39a9557d6a2646be Mon Sep 17 00:00:00 2001 From: Srinivasa Segu Date: Tue, 20 Feb 2007 02:00:50 +0000 Subject: [PATCH] Capture the version fields into the memento when setting the savepoint and restore the version information into the StateManagerImpl as a part of the rollbackToSavepoint call. Fix addresses OPENJPA-154. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@509411 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/kernel/SavepointFieldManager.java | 14 ++++++++++++++ .../apache/openjpa/kernel/StateManagerImpl.java | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SavepointFieldManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SavepointFieldManager.java index b1c8a4a82..8066cc650 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SavepointFieldManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SavepointFieldManager.java @@ -46,6 +46,9 @@ class SavepointFieldManager private final PCState _state; private PersistenceCapable _copy; + private final Object _version; + private final Object _loadVersion; + // used to track field value during store/fetch cycle private Object _field = null; private int[] _copyField = null; @@ -81,6 +84,9 @@ class SavepointFieldManager // we need to proxy the fields so that we can track future changes // from this savepoint forward for PNew instances' mutable fields _sm.proxyFields(false, false); + + _version = _sm.getVersion (); + _loadVersion = _sm.getLoadVersion (); } /** @@ -90,6 +96,14 @@ class SavepointFieldManager return _sm; } + public Object getVersion() { + return _version; + } + + public Object getLoadVersion() { + return _loadVersion; + } + /** * Return the persistence capable copy holding the savepoint field values. */ diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java index bdb2c61d6..10edaad11 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java @@ -579,6 +579,10 @@ public class StateManagerImpl assignVersionField(version); } + Object getLoadVersion() { + return _loadVersion; + } + public void setNextVersion(Object version) { assignVersionField(version); } @@ -953,6 +957,8 @@ public class StateManagerImpl _loaded = loaded; _dirty = savepoint.getDirty(); _flush = savepoint.getFlushed(); + _version = savepoint.getVersion(); + _loadVersion = savepoint.getLoadVersion(); } /**