Project

General

Profile

bug #7212

Updated by Andreas Kohlbecker about 6 years ago

in the following code loaded entities are replaced by uninitialized proxies. 
 This completely breaks the caching mechanism whenever the entity by which the cache is being updated is initialized to a lesser extent than the entity graph which was originally put. 
 This can cause LazyInitializationExceptions and unexpected multiple referencing object problems 

 ~~~java 
 Object o = field.get(cdmEntity); 
 // resetting the value in cdm entity to the deproxied object 
 o = ProxyUtils.deproxy(o); 
 field.set(cdmEntity, o); 
 Object cachedo = field.get(cachedCdmEntity); 
 CdmBase cdmEntityInSubGraph = null; 

 if(update || ProxyUtils.isProxy(cachedo)) { // <<<<<<<<<<<< if o is an uninitialized proxy cachedo will be replaced !!!!! 
     // 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 
     // 
     // if the cdm entity is a proxy then we always update to make sure that 
     // newly created entities are always up-to-date 
     // 
     // NOTE : the field is overridden in the case of the exception 
     // found below 
     field.set(cachedCdmEntity, o); 

 } 
 ~~~

Back