mirror of https://github.com/apache/openjpa.git
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:
parent
0354b057c9
commit
208be279f9
|
@ -31,11 +31,11 @@ class ENonTransState
|
||||||
extends PCState {
|
extends PCState {
|
||||||
|
|
||||||
void initialize(StateManagerImpl context) {
|
void initialize(StateManagerImpl context) {
|
||||||
context.setDirty(false);
|
|
||||||
context.clearSavedFields();
|
|
||||||
|
|
||||||
// spec says all proxies to second class objects should be reset
|
// spec says all proxies to second class objects should be reset
|
||||||
context.proxyFields(true, true);
|
context.proxyFields(true, true);
|
||||||
|
|
||||||
|
context.setDirty(false);
|
||||||
|
context.clearSavedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
PCState delete(StateManagerImpl context) {
|
PCState delete(StateManagerImpl context) {
|
||||||
|
|
|
@ -38,11 +38,11 @@ class PNonTransState
|
||||||
(PNonTransState.class);
|
(PNonTransState.class);
|
||||||
|
|
||||||
void initialize(StateManagerImpl context) {
|
void initialize(StateManagerImpl context) {
|
||||||
context.setDirty(false);
|
|
||||||
context.clearSavedFields();
|
|
||||||
|
|
||||||
// spec says all proxies to second class objects should be reset
|
// spec says all proxies to second class objects should be reset
|
||||||
context.proxyFields(true, false);
|
context.proxyFields(true, false);
|
||||||
|
|
||||||
|
context.setDirty(false);
|
||||||
|
context.clearSavedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
PCState delete(StateManagerImpl context) {
|
PCState delete(StateManagerImpl context) {
|
||||||
|
|
|
@ -2967,7 +2967,8 @@ public class StateManagerImpl
|
||||||
try {
|
try {
|
||||||
for (FieldMetaData fmd : _meta.getProxyFields()) {
|
for (FieldMetaData fmd : _meta.getProxyFields()) {
|
||||||
int index = fmd.getIndex();
|
int index = fmd.getIndex();
|
||||||
if (_loaded.get(index)) {
|
// only reload if dirty
|
||||||
|
if (_loaded.get(index) && _dirty.get(index)) {
|
||||||
provideField(_pc, _single, index);
|
provideField(_pc, _single, index);
|
||||||
if (_single.proxy(reset, replaceNull)) {
|
if (_single.proxy(reset, replaceNull)) {
|
||||||
replaceField(_pc, _single, index);
|
replaceField(_pc, _single, index);
|
||||||
|
|
|
@ -31,13 +31,13 @@ class TCleanState
|
||||||
extends PCState {
|
extends PCState {
|
||||||
|
|
||||||
void initialize(StateManagerImpl context) {
|
void initialize(StateManagerImpl context) {
|
||||||
context.clearSavedFields();
|
|
||||||
context.setLoaded(true);
|
|
||||||
context.setDirty(false);
|
|
||||||
|
|
||||||
// need to replace the second class objects with proxies that
|
// need to replace the second class objects with proxies that
|
||||||
// listen for dirtying so we can track changes to these objects
|
// listen for dirtying so we can track changes to these objects
|
||||||
context.proxyFields(true, false);
|
context.proxyFields(true, false);
|
||||||
|
|
||||||
|
context.clearSavedFields();
|
||||||
|
context.setLoaded(true);
|
||||||
|
context.setDirty(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PCState persist(StateManagerImpl context) {
|
PCState persist(StateManagerImpl context) {
|
||||||
|
|
Loading…
Reference in New Issue