[OPENJPA-2834] invalid properties cache when a propery changes

This commit is contained in:
Romain Manni-Bucau 2020-10-27 15:43:24 +01:00
parent 548e00f919
commit 6f2692228f
1 changed files with 23 additions and 0 deletions

View File

@ -262,6 +262,7 @@ public class EntityManagerImpl
public void setMultithreaded(boolean multithreaded) { public void setMultithreaded(boolean multithreaded) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setMultithreaded(multithreaded); _broker.setMultithreaded(multithreaded);
properties = null;
} }
@Override @Override
@ -273,6 +274,7 @@ public class EntityManagerImpl
public void setIgnoreChanges(boolean val) { public void setIgnoreChanges(boolean val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setIgnoreChanges(val); _broker.setIgnoreChanges(val);
properties = null;
} }
@Override @Override
@ -284,6 +286,7 @@ public class EntityManagerImpl
public void setNontransactionalRead(boolean val) { public void setNontransactionalRead(boolean val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setNontransactionalRead(val); _broker.setNontransactionalRead(val);
properties = null;
} }
@Override @Override
@ -295,6 +298,7 @@ public class EntityManagerImpl
public void setNontransactionalWrite(boolean val) { public void setNontransactionalWrite(boolean val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setNontransactionalWrite(val); _broker.setNontransactionalWrite(val);
properties = null;
} }
@Override @Override
@ -306,6 +310,7 @@ public class EntityManagerImpl
public void setOptimistic(boolean val) { public void setOptimistic(boolean val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setOptimistic(val); _broker.setOptimistic(val);
properties = null;
} }
@Override @Override
@ -317,12 +322,14 @@ public class EntityManagerImpl
public void setRestoreState(RestoreStateType val) { public void setRestoreState(RestoreStateType val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setRestoreState(val.toKernelConstant()); _broker.setRestoreState(val.toKernelConstant());
properties = null;
} }
@Override @Override
public void setRestoreState(int restore) { public void setRestoreState(int restore) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setRestoreState(restore); _broker.setRestoreState(restore);
properties = null;
} }
@Override @Override
@ -334,6 +341,7 @@ public class EntityManagerImpl
public void setRetainState(boolean val) { public void setRetainState(boolean val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setRetainState(val); _broker.setRetainState(val);
properties = null;
} }
@Override @Override
@ -345,12 +353,14 @@ public class EntityManagerImpl
public void setAutoClear(AutoClearType val) { public void setAutoClear(AutoClearType val) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoClear(val.toKernelConstant()); _broker.setAutoClear(val.toKernelConstant());
properties = null;
} }
@Override @Override
public void setAutoClear(int autoClear) { public void setAutoClear(int autoClear) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoClear(autoClear); _broker.setAutoClear(autoClear);
properties = null;
} }
@Override @Override
@ -362,12 +372,14 @@ public class EntityManagerImpl
public void setDetachState(DetachStateType type) { public void setDetachState(DetachStateType type) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setDetachState(type.toKernelConstant()); _broker.setDetachState(type.toKernelConstant());
properties = null;
} }
@Override @Override
public void setDetachState(int detach) { public void setDetachState(int detach) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setDetachState(detach); _broker.setDetachState(detach);
properties = null;
} }
@Override @Override
@ -379,30 +391,35 @@ public class EntityManagerImpl
public void setAutoDetach(AutoDetachType flag) { public void setAutoDetach(AutoDetachType flag) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(flag))); _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(flag)));
properties = null;
} }
@Override @Override
public void setAutoDetach(EnumSet<AutoDetachType> flags) { public void setAutoDetach(EnumSet<AutoDetachType> flags) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(AutoDetachType.fromEnumSet(flags)); _broker.setAutoDetach(AutoDetachType.fromEnumSet(flags));
properties = null;
} }
@Override @Override
public void setAutoDetach(int autoDetachFlags) { public void setAutoDetach(int autoDetachFlags) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(autoDetachFlags); _broker.setAutoDetach(autoDetachFlags);
properties = null;
} }
@Override @Override
public void setAutoDetach(AutoDetachType value, boolean on) { public void setAutoDetach(AutoDetachType value, boolean on) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(value)),on); _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(value)),on);
properties = null;
} }
@Override @Override
public void setAutoDetach(int flag, boolean on) { public void setAutoDetach(int flag, boolean on) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setAutoDetach(flag, on); _broker.setAutoDetach(flag, on);
properties = null;
} }
@Override @Override
@ -414,6 +431,7 @@ public class EntityManagerImpl
public void setEvictFromStoreCache(boolean evict) { public void setEvictFromStoreCache(boolean evict) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setEvictFromDataCache(evict); _broker.setEvictFromDataCache(evict);
properties = null;
} }
@Override @Override
@ -425,6 +443,7 @@ public class EntityManagerImpl
public void setPopulateStoreCache(boolean cache) { public void setPopulateStoreCache(boolean cache) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setPopulateDataCache(cache); _broker.setPopulateDataCache(cache);
properties = null;
} }
@Override @Override
@ -436,6 +455,7 @@ public class EntityManagerImpl
public void setTrackChangesByType(boolean trackByType) { public void setTrackChangesByType(boolean trackByType) {
assertNotCloseInvoked(); assertNotCloseInvoked();
_broker.setTrackChangesByType(trackByType); _broker.setTrackChangesByType(trackByType);
properties = null;
} }
@Override @Override
@ -1349,6 +1369,7 @@ public class EntityManagerImpl
_broker.assertOpen(); _broker.assertOpen();
_broker.getFetchConfiguration().setFlushBeforeQueries _broker.getFetchConfiguration().setFlushBeforeQueries
(toFlushBeforeQueries(flushMode)); (toFlushBeforeQueries(flushMode));
properties = null;
} }
@Override @Override
@ -2150,6 +2171,7 @@ public class EntityManagerImpl
kType = setter.getParameterTypes()[0]; kType = setter.getParameterTypes()[0];
kValue = convertUserValue(original, value, kType); kValue = convertUserValue(original, value, kType);
Reflection.set(target, setter, kValue); Reflection.set(target, setter, kValue);
properties = null;
return true; return true;
} else { } else {
Field field = Reflection.findField(target.getClass(), beanProp, false); Field field = Reflection.findField(target.getClass(), beanProp, false);
@ -2157,6 +2179,7 @@ public class EntityManagerImpl
kType = field.getType(); kType = field.getType();
kValue = convertUserValue(original, value, kType); kValue = convertUserValue(original, value, kType);
Reflection.set(target, field, kValue); Reflection.set(target, field, kValue);
properties = null;
return true; return true;
} }
} }