db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core QueryReferenceBroker.java
Date Thu, 13 May 2004 10:05:43 GMT
arminw      2004/05/13 03:05:43

  Modified:    src/java/org/apache/ojb/broker/core
                        QueryReferenceBroker.java
  Log:
  fix bug posted by Andrew Clute:
  
  In my case, I have a nullifiedFKValue, so it goes into the first If
  block, and then it sees that it is an AnonymousKeyReference, but then my
  referencesObject us null (like it should be). But instead of returning
  null, it jums out to the bottom where it returns a new Identity!!
  
  Revision  Changes    Path
  1.16      +11 -12    db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
  
  Index: QueryReferenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- QueryReferenceBroker.java	6 May 2004 19:45:57 -0000	1.15
  +++ QueryReferenceBroker.java	13 May 2004 10:05:43 -0000	1.16
  @@ -342,7 +342,7 @@
               {
                   refObj = pb.doGetObjectByIdentity(id);
               }
  -            else if ((m_retrievalTasks != null) 
  +            else if ((m_retrievalTasks != null)
                       && !rds.isLazy()
                       && (rds.getItemProxyClass() == null))
               {
  @@ -411,10 +411,10 @@
           /*
           BRJ: if all fk values are null there's no referenced object
   
  -        arminw: expect the given object has nullified FK values but the referenced
  +        arminw: Supposed the given object has nullified FK values but the referenced
           object still exists. This could happend after serialization of the main object.
In
  -        this case all anonymous field (AK) information is lost - AnonymousPersistentField
class
  -        use the object identity to cache the AK values
  +        this case all anonymous field (AK) information is lost, because AnonymousPersistentField
class
  +        use the object identity to cache the AK values. But we can build Identity anyway
from the reference
           */
           if (hasNullifiedFKValue)
           {
  @@ -426,14 +426,13 @@
                       return new Identity(referencedObject, pb);
                   }
               }
  -            else
  -            {
  -                return null;
  -            }
           }
  -
  -        // ensure that top-level extents are used for Identities
  -        return new Identity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()),
fkValues);
  +        else
  +        {
  +            // ensure that top-level extents are used for Identities
  +            return new Identity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()),
fkValues);
  +        }
  +        return null;
       }
   
       // BRJ: check if we have non null fk values
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message