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

Dmitry Katsubo (JIRA) noreply at atlassian.com
Sat Jul 24 10:37:35 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37910#action_37910 ] 

Dmitry Katsubo commented on HHH-3724:
-------------------------------------

I vote this issue. For boolean properties it is nice to have an additional check for "is-" and "has-" getters. Very useful when somebody wants to map entities, generated by e.g. JAXB.

> 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