db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r518403 - /db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
Date Thu, 15 Mar 2007 00:57:12 GMT
Author: arminw
Date: Wed Mar 14 17:57:12 2007
New Revision: 518403

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

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

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java?view=diff&rev=518403&r1=518402&r2=518403
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java Wed Mar 14
17:57:12 2007
@@ -607,17 +607,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


Mime
View raw message