[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3724) Bug in determining the getter method for property

Senthil (JIRA) noreply at atlassian.com
Tue Jan 20 14:25:38 EST 2009


Bug in determining the getter method for property 
--------------------------------------------------

                 Key: HHH-3724
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3724
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
         Environment: hibernate-core-3.3.1.GA.jar, Oracle Express Edition 10g
            Reporter: Senthil
            Priority: Minor


I have an entity class with a property "String nextOnError" mapping to the database column "varchar nextOnError". I have a getter method "String getNextOnError()" defined in the class. But I also have another method "boolean isNextOnError()" for my other processing in the application. I was expecting hibernate would pick the getter method "String getNextOnError()"  as the getter method but it is not. It is always picking the "boolean isNextOnError()" and resulting in "Class cast exception: java.lang.Boolean" during insertion. This is because,  for each property, in the class "org.hibernate.property.BasicPropertyAccessor", the method "getterMethod(Class theClass, String propertyName)" is looping through all the getter methods with no arguments. The loop breaks when it finds any method starts with either "isNextOnError()" or "getNextOnError()". Unfortunately, in my case, it always ends up with "boolean isNextOnError()". I think the correct way is to check all the methods for starting with get... and if nothing is found, then start looking for method starting with 'is...' . 

Thanks. 

-- 
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