merge from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / taxeditor / remoting / cache / CdmTransientEntityCacher.java
index e182787806c87fc8fdce2319e61ca23614039beb..b3fe25e887861970704016840de7e493c116b20e 100644 (file)
@@ -344,12 +344,17 @@ public class CdmTransientEntityCacher  {
                        field.setAccessible(true);
                        Object o = field.get(cdmEntity);
 
+                       // in the case that we are (re) loading a cdm entity with a null (most probably deleted) field
+                       // we need to set the same field in the corresponding cached cdm entity to null
+                       if(o == null) {
+                           field.set(cachedCdmEntity, null);
+                       }
+
                        CdmBase cdmEntityInSubGraph = null;
                        if(o != null
                                        && !ProxyFactory.isProxyClass(o.getClass())
                                        && !(o instanceof PersistentCollection) ) {
 
-
                                if(CdmBase.class.isAssignableFrom(o.getClass())) {
                                        logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
                                        cdmEntityInSubGraph  = (CdmBase)o;