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 [EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to