OPENJPA-2167. Only reload the proxy fields if the field is loaded and dirty.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1307217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2012-03-30 02:02:50 +00:00
parent 0354b057c9
commit 208be279f9
4 changed files with 12 additions and 11 deletions

View File

@ -31,11 +31,11 @@ class ENonTransState
extends PCState {
void initialize(StateManagerImpl context) {
context.setDirty(false);
context.clearSavedFields();
// spec says all proxies to second class objects should be reset
context.proxyFields(true, true);
context.setDirty(false);
context.clearSavedFields();
}
PCState delete(StateManagerImpl context) {

View File

@ -38,11 +38,11 @@ class PNonTransState
(PNonTransState.class);
void initialize(StateManagerImpl context) {
context.setDirty(false);
context.clearSavedFields();
// spec says all proxies to second class objects should be reset
context.proxyFields(true, false);
context.setDirty(false);
context.clearSavedFields();
}
PCState delete(StateManagerImpl context) {

View File

@ -2967,7 +2967,8 @@ public class StateManagerImpl
try {
for (FieldMetaData fmd : _meta.getProxyFields()) {
int index = fmd.getIndex();
if (_loaded.get(index)) {
// only reload if dirty
if (_loaded.get(index) && _dirty.get(index)) {
provideField(_pc, _single, index);
if (_single.proxy(reset, replaceNull)) {
replaceField(_pc, _single, index);

View File

@ -31,13 +31,13 @@ class TCleanState
extends PCState {
void initialize(StateManagerImpl context) {
context.clearSavedFields();
context.setLoaded(true);
context.setDirty(false);
// need to replace the second class objects with proxies that
// listen for dirtying so we can track changes to these objects
context.proxyFields(true, false);
context.clearSavedFields();
context.setLoaded(true);
context.setDirty(false);
}
PCState persist(StateManagerImpl context) {