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
This commit is contained in:
Srinivasa Segu 2007-02-20 02:00:50 +00:00
parent 8974a09908
commit 09e7aab777
2 changed files with 20 additions and 0 deletions

View File

@ -46,6 +46,9 @@ class SavepointFieldManager
private final PCState _state; private final PCState _state;
private PersistenceCapable _copy; private PersistenceCapable _copy;
private final Object _version;
private final Object _loadVersion;
// used to track field value during store/fetch cycle // used to track field value during store/fetch cycle
private Object _field = null; private Object _field = null;
private int[] _copyField = null; private int[] _copyField = null;
@ -81,6 +84,9 @@ class SavepointFieldManager
// we need to proxy the fields so that we can track future changes // we need to proxy the fields so that we can track future changes
// from this savepoint forward for PNew instances' mutable fields // from this savepoint forward for PNew instances' mutable fields
_sm.proxyFields(false, false); _sm.proxyFields(false, false);
_version = _sm.getVersion ();
_loadVersion = _sm.getLoadVersion ();
} }
/** /**
@ -90,6 +96,14 @@ class SavepointFieldManager
return _sm; return _sm;
} }
public Object getVersion() {
return _version;
}
public Object getLoadVersion() {
return _loadVersion;
}
/** /**
* Return the persistence capable copy holding the savepoint field values. * Return the persistence capable copy holding the savepoint field values.
*/ */

View File

@ -579,6 +579,10 @@ public class StateManagerImpl
assignVersionField(version); assignVersionField(version);
} }
Object getLoadVersion() {
return _loadVersion;
}
public void setNextVersion(Object version) { public void setNextVersion(Object version) {
assignVersionField(version); assignVersionField(version);
} }
@ -953,6 +957,8 @@ public class StateManagerImpl
_loaded = loaded; _loaded = loaded;
_dirty = savepoint.getDirty(); _dirty = savepoint.getDirty();
_flush = savepoint.getFlushed(); _flush = savepoint.getFlushed();
_version = savepoint.getVersion();
_loadVersion = savepoint.getLoadVersion();
} }
/** /**