Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351979 - Changes to DatabaseField getNameForComparisons()
Summary: Changes to DatabaseField getNameForComparisons()
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Gordon Yorke CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 10:23 EDT by Guy Pelletier CLA
Modified: 2022-06-09 10:05 EDT (History)
3 users (show)

See Also:


Attachments
Additional Patch (836 bytes, patch)
2011-09-02 12:52 EDT, Gordon Yorke CLA
no flags Details | Diff
Another additional patch (22.72 KB, patch)
2011-09-15 15:39 EDT, Gordon Yorke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guy Pelletier CLA 2011-07-13 10:23:20 EDT
Not sure if the changes from revision 8851 captured the intended changes to DatabaseField getNameForComparisons() correctly?

The method currently looks as follows:

    public String getNameForComparisons(){
        if (this.nameForComparisons == null) {
            if ((!this.useUpperCaseForComparisons) || (this.name == null)) {
                this.nameForComparisons = this.name;
            }
            this.nameForComparisons = this.name.toUpperCase();
        }
        return this.nameForComparisons;
    }

Thinking maybe we missed an else statement on the nested if?
Comment 1 James Sutherland CLA 2011-08-02 11:29:37 EDT
checked into trunk and 2.3
Comment 2 Gordon Yorke CLA 2011-08-16 14:40:47 EDT
This patch has caused a regression in our metadata column name case insensitivity.   Since 2.2 we have been case insensitive by default because the reported method always set and returned the 'nameForComparisons'.

As JPA spec section 2.13 requires that our metadata comparisons be case insensitive we should use this patch but also ensure the useUpperCaseForComparisons is set to true by default for JPA.
Comment 3 James Sutherland CLA 2011-09-01 10:01:17 EDT
Not sure I understand?

The original code for this before my change was,


    public String getNameForComparisons(){
        if (nameForComparisons == null) {
            if (!getUseUpperCaseForComparisons() || getName()== null){
                return this.getName();
            }
            this.nameForComparisons = this.getName().toUpperCase();
        }
        return this.nameForComparisons;
    }


Note the return, which did not use upper-case when set not to use upper case.

This fix just reverts the code to the original functionality before my initial change made Jan 19, 2011, which was always the intended functionality.

If we want to change our case defaults, that should be a different bug.  This bug is just fixing a coding error.
Comment 4 Gordon Yorke CLA 2011-09-02 11:18:25 EDT
The issue is the changes you made to the code that always uses uppercase names from comparisons was present in 2 major releases.  For both those releases we correctly ignored case when comparing fields throughout the product.  Now with this change 2.3.1 regresses and is again case sensitive for field comparisons.

The change in this bug caused the regression.
Comment 5 Gordon Yorke CLA 2011-09-02 12:52:54 EDT
Created attachment 202685 [details]
Additional Patch

This patch should be included with the initial patch within the bug.  Together they revert the code bug while continuing to support case insensitive comparisons
Comment 6 Gordon Yorke CLA 2011-09-02 13:26:13 EDT
Additional Patch checked into 2.3.1 and trunk
Comment 7 Gordon Yorke CLA 2011-09-15 15:39:20 EDT
Created attachment 203446 [details]
Another additional patch

The "additional patch" did not actually change the default.  Other changes are required to ensure EclipseLink is case insensitive by default.  A combination of all 3 patches is required to resolve this issue.
Comment 8 Gordon Yorke CLA 2011-09-21 09:37:11 EDT
Checked in trunk and 2.3.1, reviewed by Guy Pelletier
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:05:40 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink