You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Hubert Hausegger <ha...@gmx.net> on 2003/03/06 20:53:07 UTC

Bug in PersistenceBrokerImpl

Hi All!

I'm using OJB in a project with about 90 Business/Entity - Classes with
objectreferences and a single rootclass. I've noticed a very poor
performance in loading objects from the db. When they are loaded 
into the cache, everything is fine. 
Loading about 100 objects into the cache took about 100secs!

Looking into the PersistenceBrokerImpl.java I found the Problem:

/**
 * retrieves an Object reference.
 * <br>
 * If there is a Proxy-class is defined in the ReferenceDescriptor or
 * if the ReferenceDescriptor is lazy, a Proxy-object is returned.
 * <br>
 * If no Proxy-class is defined, a getObjectByIdentity(...) lookup is
performed.
 * <br>
 * Null is returned if all foreign keys are null
 */
private Object getReferencedObject(Object obj,
                                                    
ObjectReferenceDescriptor rds,
                                                     ClassDescriptor cld)  {
        Class referencedClass = rds.getItemClass();

  <bug>
  // ensure that top-level extents are used for Identities
  //hh: referencedClass = 
  //hh:              descriptorRepository.getTopLevelClass(referencedClass);
  </bug>

  Object[] pkVals = rds.getForeignKeyValues(obj, cld);
  Class referencedProxy;
  boolean allPkNull = true;


To get a referenced object, the persistence broker was searching the object
in all tables and not just in the tables down the inheritance tree!! 
(I'm using 1 class /table)
After removing the statement listed above, the same operation now
takes only 3 secs!. Is'nt this a great Performance Improvement?

By the way: OJB is a great project - thank you guys!

 - Hubert

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


Re: Bug in PersistenceBrokerImpl

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Hubert,

I post your proposal to the dev-list to
discuss the side-effects.

regards,
Armin

----- Original Message -----
From: "Hubert Hausegger" <ha...@gmx.net>
To: <oj...@db.apache.org>
Sent: Thursday, March 06, 2003 8:53 PM
Subject: Bug in PersistenceBrokerImpl


> Hi All!
>
> I'm using OJB in a project with about 90 Business/Entity - Classes
with
> objectreferences and a single rootclass. I've noticed a very poor
> performance in loading objects from the db. When they are loaded
> into the cache, everything is fine.
> Loading about 100 objects into the cache took about 100secs!
>
> Looking into the PersistenceBrokerImpl.java I found the Problem:
>
> /**
>  * retrieves an Object reference.
>  * <br>
>  * If there is a Proxy-class is defined in the ReferenceDescriptor or
>  * if the ReferenceDescriptor is lazy, a Proxy-object is returned.
>  * <br>
>  * If no Proxy-class is defined, a getObjectByIdentity(...) lookup is
> performed.
>  * <br>
>  * Null is returned if all foreign keys are null
>  */
> private Object getReferencedObject(Object obj,
>
> ObjectReferenceDescriptor rds,
>                                                      ClassDescriptor
cld)  {
>         Class referencedClass = rds.getItemClass();
>
>   <bug>
>   // ensure that top-level extents are used for Identities
>   file://hh: referencedClass =
>   file://hh:
descriptorRepository.getTopLevelClass(referencedClass);
>   </bug>
>
>   Object[] pkVals = rds.getForeignKeyValues(obj, cld);
>   Class referencedProxy;
>   boolean allPkNull = true;
>
>
> To get a referenced object, the persistence broker was searching the
object
> in all tables and not just in the tables down the inheritance tree!!
> (I'm using 1 class /table)
> After removing the statement listed above, the same operation now
> takes only 3 secs!. Is'nt this a great Performance Improvement?
>
> By the way: OJB is a great project - thank you guys!
>
>  - Hubert
>
> --
> +++ GMX - Mail, Messaging & more  http://www.gmx.net +++
> Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>