Project

General

Profile

bug #7212

CacheLoader replaces loaded entities with uninitialized proxies

Added by Andreas Kohlbecker 11 months ago. Updated 11 months ago.

Status:
Resolved
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
01/23/2018
Due date:
% Done:

50%

Severity:
critical
Found in Version:
Tags:

Description

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

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);

}

Related issues

Related to Edit - bug #7206: CdmEntityCache not correctly updating with entitiy graphs loaded afterwards Closed 01/18/2018

Associated revisions

Revision 9a2bace3 (diff)
Added by Andreas Kohlbecker 11 months ago

fix #7212 preventing loaded entities from being replaces by uninitialized proxies

Revision 02a47bbb (diff)
Added by Andreas Kohlbecker 11 months ago

fix #7212 preventing loaded entities from being replaces by uninitialized proxies

Revision 6cc5e931 (diff)
Added by Andreas Kohlbecker 11 months ago

ref #7212 method documentation

History

#1 Updated by Andreas Kohlbecker 11 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#2 Updated by Andreas Kohlbecker 11 months ago

wer kennt sich mit dem cache genügend aus um den review zu machen?

#3 Updated by Andreas Kohlbecker 11 months ago

  • Description updated (diff)

#4 Updated by Katja Luther 11 months ago

because of

 o = ProxyUtils.deproxy(o); 

I think o should never be a proxy. or am I wrong??

#5 Updated by Andreas Kohlbecker 11 months ago

the method signature is not really clear about the behavior of this method
It only de-proxies the passed object o if it is an initialized proxy object,o is returned.

#6 Updated by Andreas Kohlbecker 11 months ago

  • Related to bug #7206: CdmEntityCache not correctly updating with entitiy graphs loaded afterwards added

#7 Updated by Andreas Kohlbecker 11 months ago

  • Assignee changed from Andreas Kohlbecker to Andreas Müller

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)