Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265597 - ObjectTypeConverter defaultObjectValue should handle null values
Summary: ObjectTypeConverter defaultObjectValue should handle null values
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-20 02:08 EST by Ari Meyer CLA
Modified: 2022-06-09 10:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ari Meyer CLA 2009-02-20 02:08:49 EST
Build ID: 1.0.2

Steps To Reproduce:
Oracle 10.2

1.  For my example, the field is a nullable VARCHAR2(1).  The possible values for the field should be "Y" or NULL, mapping to true, or "N" for false.

2.  Declaration:
@Column(name = "INACTIVE_IND")
    @ObjectTypeConverter(
        name="booleanConverter_N-false",
        dataType=java.lang.String.class,
        objectType=java.lang.Boolean.class,
        conversionValues={
            @ConversionValue(dataValue="N", objectValue="false")
        },
        defaultObjectValue="true")
    @Convert("booleanConverter_N-false")
    private boolean active;

3.  always returns false for null values


More information:
james.sutherland@oracle.com told me in the eclipse.rt.eclipselink newsgroup to submit this bug, with this note:

This is occurring as the ObjectTypeConverter has special handling for null values.

The defaultObjectValue does not handle null values.  But perhaps it should so feel free to log a bug for this. "defaultObjectValue" is only for if you have legacy data that has other values than you have set, and want to default these.  The mapping has a nullValue that can be set for the value for null, but there does not seem to be a way to set this through annotations (please log a bug), you can set it using a DescriptorCustomizer.
For null, the converter allows the conversion value for null to be set, i.e. null=true, but there does not seem to be a way to set null through annotations, maybe log a bug for this.  You can set the conversion for null in code.
Comment 1 Tom Ware CLA 2009-02-25 12:50:34 EST
Targetting for 1.1.x - will be a candidate for next patch release after 1.1.
Comment 2 Ari Meyer CLA 2009-10-07 18:01:24 EDT
Any update on this bug?

Thanks,
Ari
Comment 3 Tom Ware CLA 2009-10-08 07:54:49 EDT
Updating priority to P3 for 2.0.  For information about what this means see:  http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 4 Peter Krogh CLA 2009-11-27 13:41:00 EST
This bug fix did not make the cut off for 2.0.0. We are deferring the bugs to Future where we can properly sort them all together based on community votes and severity. We will then assign them accordingly to future patch sets and releases.
Comment 5 Peter Krogh CLA 2009-11-30 11:36:08 EST
Changing the priority of the bugs that have been recently triaged to future.  Targetting them to P2 will differentiate them from the P3s that have been triaged into future earlier.
Comment 6 Ari Meyer CLA 2012-03-29 19:49:40 EDT
This bug is over 3 years old -- any update?

Thanks,
Ari
Comment 7 Tom Ware CLA 2012-03-30 09:03:30 EDT
I encourage the community to vote on this bug if it is a high priority.
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:14:07 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:22:57 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink