Null handling in 2.5 [message #1115879] |
Tue, 24 September 2013 18:16  |
Eclipse User |
|
|
|
I am using Postgresql and eclipselink 2.5. Instead of using JPA, I am using class descriptor/mapping API to establish mapping. I found all my float null value is shown as 0.0. I traced this down to org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.bypassDefaultNullValueCheck. If the value is null, and this field is false, eclipselink tries to convert null value to something. The problem is that this field bypassDefaultNullValueCheck is protected, I have no method to set it to true when I am using DirectToFieldMapping which is a subclass.
Is there a way to tell eclipselink not to touch null value?
thanks
-jason
|
|
|
Re: Null handling in 2.5 [message #1115900 is a reply to message #1115879] |
Tue, 24 September 2013 19:04   |
Eclipse User |
|
|
|
This should only occur by default if the attribute type is a float primitive instead of the Float wrapper type, as primitives cannot be set to null. The bypassDefaultNullValueCheck flag is set in AbstractDirectMapping's preInitialize method based on the mapping's attributeClassification. If you are able to debug the code, check that the attributeClassification is correct for your mapping and is using the wrapper class, and that you are not adding in a default value for the specified class using a setDefaultNullValue method.
Best Regards,
Chris
|
|
|
|
Powered by
FUDForum. Page generated in 0.03475 seconds