Inserting the following patch into my BrokerHelper class fixed my problem.

    public boolean representsNull(FieldDescriptor fld, Object aValue)
    {
        if(aValue == null) return true;

boolean result = false;
if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0)))
{
//result = fld.getPersistentField().getType().isPrimitive();
// PATCH STARTS HERE
PersistentField field = fld.getPersistentField();
Class type = field.getType();



// AnonymousPersistentFields will *always* have a null type according to the
// javadoc comments in AnonymousPersistentField.getType()
if (type == null) {
// anonymous field never represents a primitive field with value 0, but will return a null type
return false;
}
result = type.isPrimitive();
// PATCH ENDS HERE
}
// TODO: Do we need this check?? String could be nullified, why should we assume
// it's 'null' on empty string?
else if((aValue instanceof String) && (((String) aValue).length() == 0))
{
result = fld.isPrimaryKey();
}
return result;
}


Is this a safe patch?
Is there a case where aValue could pass the aValue instanceof Number) && (((Number) aValue).longValue() == 0 checks and yet still produce a null type other than when it is an anonymous key?


should we expect a patch like this to appear in the CVS or next release?

thanks everyone!



should be ok - except one difference: He always return 'true' for anonymous fields, I would suggest always return 'false', because the anonymous field never represents a primitive field with value 0.

regards,
Armin




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to