Project

General

Profile

Actions

bug #7212

open

CacheLoader replaces loaded entities with uninitialized proxies

Added by Andreas Kohlbecker about 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

50%

Estimated time:
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 afterwardsClosedAndreas Kohlbecker

Actions
Actions #1

Updated by Andreas Kohlbecker about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50
Actions #2

Updated by Andreas Kohlbecker about 6 years ago

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

Actions #3

Updated by Andreas Kohlbecker about 6 years ago

  • Description updated (diff)
Actions #4

Updated by Katja Luther about 6 years ago

because of

 o = ProxyUtils.deproxy(o); 

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

Actions #5

Updated by Andreas Kohlbecker about 6 years 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.

Actions #6

Updated by Andreas Kohlbecker about 6 years ago

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

Updated by Andreas Kohlbecker about 6 years ago

  • Assignee changed from Andreas Kohlbecker to Andreas Müller
Actions

Also available in: Atom PDF