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