From 07cebe78260be5565f9750eb0b4d758841efae46 Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Wed, 18 Mar 2015 17:35:43 +0000 Subject: [PATCH] moved cached cdm entity field update for only CdmBase objects --- .../taxeditor/remoting/cache/CacheLoader.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java index a1e430cb6..02ae45670 100644 --- a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java +++ b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java @@ -315,20 +315,22 @@ public class CacheLoader { } field.setAccessible(true); Object o = field.get(cdmEntity); + // resetting the value in cdm entity to the deproxied object o = ProxyUtils.deproxy(o); field.set(cdmEntity, o); CdmBase cdmEntityInSubGraph = null; - if(update) { - // if we are in update mode we have to make the field of the cached entity - // up-to-date by setting it to the value of the cdm entity being loaded - // NOTE : two exceptions to this are found below - field.set(cachedCdmEntity, o); - } if(o != null && !ProxyUtils.isProxy(o)) { if(CdmBase.class.isAssignableFrom(o.getClass())) { logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId()); + if(update) { + // if we are in update mode we have to make the field of the cached entity + // up-to-date by setting it to the value of the cdm entity being loaded + // NOTE : two exceptions to this are found below + field.set(cachedCdmEntity, o); + + } cdmEntityInSubGraph = (CdmBase)o; CdmBase cachedCdmEntityInSubGraph = cdmCacher.getFromCache(cdmEntityInSubGraph); -- 2.34.1