[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3596) Wrong way of finding accessor methods of a property

Raimar Falke (JIRA) noreply at atlassian.com
Tue Nov 11 08:24:17 EST 2008


Wrong way of finding accessor methods of a property
---------------------------------------------------

                 Key: HHH-3596
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3596
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
         Environment: Actual problem with 3.2.1
But current source code (http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/trunk/core/src/main/java/org/hibernate/property/BasicPropertyAccessor.java?revision=14993&view=markup) works in a similar way.
            Reporter: Raimar Falke
            Priority: Minor


 org.hibernate.property.BasicPropertyAccessor.createGetter uses 
the direction (accessor method name -> property name) for finding
the accessor methods for a given property.

This causes problems with properties which have a name like 
"xCoord" (first letter lowercase, second uppercase, rest doesn't 
matter). The accessor methods in the source code will be 
getXCoord and setXCoord.

Because of the way BasicPropertyAccessor.getterMethod is 
implemented the method getXCoord is not found. The reason 
is the special case for decapitalizing accessor names. So 
getXCoord will become XCoord after the substring
and will stay XCoord after decapitalizing. This doesn't match the
property name. And so no method is found resulting in an exception:
org.hibernate.PropertyNotFoundException: Could not find a getter for xCoord ...

Better is the other direction (property name -> accessor 
method name) with a final method lookup.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list