You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2007/03/15 01:56:54 UTC

svn commit: r518402 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java

Author: arminw
Date: Wed Mar 14 17:56:53 2007
New Revision: 518402

URL: http://svn.apache.org/viewvc?view=rev&rev=518402
Log:
fix OJB-92, compound FK is "null" if at least one field is null

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java?view=diff&rev=518402&r1=518401&r2=518402
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java Wed Mar 14 17:56:53 2007
@@ -581,17 +581,28 @@
         return null;
     }
 
-    // BRJ: check if we have non null fk values
-    // TBD  we should also check primitives
-    // to avoid creation of unmaterializable proxies
-    private boolean hasNullifiedFK(FieldDescriptor[] fkFieldDescriptors, Object[] fkValues)
+    /**
+     * This method checks whether or not a FK reference is 'null'. This
+     * implementation returns 'true' if at least one FK field (of a compound FK)
+     * is 'null' (see {@link FieldDescriptor#representsNull(Object)}).
+     */
+    protected boolean hasNullifiedFK(FieldDescriptor[] fkFieldDescriptors, Object[] fkValues)
     {
-        boolean result = true;
+        /*
+        BRJ:
+        check if we have non null fk values
+        TBD:
+        we should also check primitives
+        to avoid creation of unmaterializable proxies
+        arminw:
+        Fix for OJB-92, this method should return true if at least only FK field is null
+        */
+        boolean result = false;
         for (int i = 0; i < fkValues.length; i++)
         {
-            if (!pb.serviceBrokerHelper().representsNull(fkFieldDescriptors[i], fkValues[i]))
+            if (fkFieldDescriptors[i].representsNull(fkValues[i]))
             {
-                result = false;
+                result = true;
                 break;
             }
         }



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