Bug 234222 - property name generation differs from Introspector.decapitalize
Summary: property name generation differs from Introspector.decapitalize
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-27 15:05 EDT by Chris Delahunt CLA
Modified: 2022-06-09 10:22 EDT (History)
3 users (show)

See Also:


Attachments
proposed patch (30.48 KB, patch)
2010-04-23 13:37 EDT, Chris Delahunt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Delahunt CLA 2008-05-27 15:05:05 EDT
This was found through a forum post at
  http://forums.java.net/jive/thread.jspa?messageID=276831#276831

When getID/setID is used, the property name used in Eclipselink is iD.
With the previous example, using JPQL: "SELECT emp.ID from Employee emp" will throw an error, but "SELECT emp.iD from Employee emp" will work.  

2.1.1. of the spec states in a note that
 "Specifically, if getX is the name of the getter method and setX is the name ofthe setter method, where X is a string, the name of the
persistent property is defined by the result of java.beans.Introspector.decapitalize(X)."

The decapitalize method should leave the property name in uppercase if the first and second characters are uppercase - so EclipseLink should be using the property name as ID.
Comment 1 Doug Clarke CLA 2008-07-07 13:33:27 EDT
Changed version to unspecified
Comment 2 Tom Ware CLA 2009-04-16 10:58:10 EDT
Updating priority due to revised bug categorization process.  See the following page for details:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines#Priority_and_Target_Milestone 

If you feel the updated priority is incorrect, please send an email to eclipselink-users@eclipse.org.
Comment 3 Karen Butzke CLA 2010-02-16 17:32:05 EST
This looks like a major bug to me, not just affecting ddl generation.  This also means that mappedBy references would be incorrect in EclipseLink (and MapKey, MapsId, references in xml, etc).  Dali and EclipseLink are also at odds on this one, Dali giving a validation error for something that works in EclipseLink and vice versa.  Dali is using the JavaBeans Introspector.decapitalize api.
Comment 4 Tom Ware CLA 2010-02-18 09:32:53 EST
Upgrading priority
Comment 5 Chris Delahunt CLA 2010-04-23 13:37:58 EDT
Created attachment 165941 [details]
proposed patch

This patch might change behaviour for some, as methods with annotations such as getCCustomers that would have properties named "cCustomers" are now going to have properties named "CCustomers".  This might mean that JPQL accessing the property will need to change.
Comment 6 Chris Delahunt CLA 2010-04-23 15:23:57 EDT
patch checked into trunk
Comment 7 Rick Sapir CLA 2010-05-17 10:44:55 EDT
Added doc note in resolved issues of release notes for 2.1
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:22:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink