Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Null handling in 2.5(There is should be an option that Null can be treated as Null)
Null handling in 2.5 [message #1115879] Tue, 24 September 2013 18:16 Go to next message
jason zhang is currently offline jason zhang
Messages: 30
Registered: July 2009
Member
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 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
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
Re: Null handling in 2.5 [message #1115923 is a reply to message #1115900] Tue, 24 September 2013 19:38 Go to previous message
jason zhang is currently offline jason zhang
Messages: 30
Registered: July 2009
Member
Great! It works after I set the AttributeClassification to Float.Class instead of float.class.
Previous Topic:StaticWeave, Windows, and Stack Trace Line Numbers
Next Topic:Moxy and Reference Impl schemas do not match
Goto Forum:
  


Current Time: Thu Oct 23 03:55:14 GMT 2014

Powered by FUDForum. Page generated in 0.02797 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software