db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clute, Andrew" <Andrew.Cl...@osn.state.oh.us>
Subject RE: Bug in QueryReferenceBroker?
Date Wed, 12 May 2004 21:49:56 GMT
 Sorry, meant to send this to Dev list



-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us] 
Sent: Wednesday, May 12, 2004 5:49 PM
To: OJB Users List
Subject: RE: Bug in QueryReferenceBroker?

I created what I think is an appropriate patch -- it fixed my issue.
Here it is.

Index: QueryReferenceBroker.java
===================================================================
RCS file:
/home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenc
eBroker.java,v
retrieving revision 1.15
diff -u -r1.15 QueryReferenceBroker.java
--- QueryReferenceBroker.java	6 May 2004 19:45:57 -0000	1.15
+++ QueryReferenceBroker.java	12 May 2004 21:47:44 -0000
@@ -425,6 +425,7 @@
                 {
                     return new Identity(referencedObject, pb);
                 }
+                return null;
             }
             else
             {

 

-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us]
Sent: Wednesday, May 12, 2004 5:37 PM
To: OJB Users List; OJB Developers List
Subject: Bug in QueryReferenceBroker?

I recently updated to HEAD and am finding a weird issue now.

I have an object Session, that has a reference to an Object called
Person. Now Person is a proxy object. I am using an Anonymous FK to
reference Person from Session.

When I try to restore Session when it has no Person hanging on it, it
restores the Session object with a Person Proxy object hanging off of it
(it shouldn't!), and the Proxy's PK being a collection of null.

I think I might have narrowed down why it is happening:

Method getReferencedObjectIdentity(), here is a code snipet:

 if (hasNullifiedFKValue)
 {
      if(isAnonymousKeyReference(cld, rds))
       {
            Object referencedObject = rds.getPersistentField().get(obj);
             if(referencedObject != null)
              {
                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);

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!! Why is
it doing that? I can see where Armin has made some changes to handle
better AnonymousFK's, is this a side-effect of that?

-ANdrew


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


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