[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-751) Hibernate reports erroneous "possible typo error" for properties with protected accessor methods

Jean-Louis MONTEIRO (JIRA) noreply at atlassian.com
Wed Aug 19 04:49:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33814#action_33814 ] 

Jean-Louis MONTEIRO commented on ANN-751:
-----------------------------------------

As the spec allows using protected fields, it seems to me this issue is more a bug than an improvement.
In the constructor of EJB3OverridenAnnotationReader, Hibernate already looks for DeclaredFields and DeclaredMethods instead of just public fields and methods. So I believe checkForOrphanProperties must do that too.

> Hibernate reports erroneous "possible typo error" for properties with protected accessor methods
> ------------------------------------------------------------------------------------------------
>
>                 Key: ANN-751
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-751
>             Project: Hibernate Annotations
>          Issue Type: Improvement
>    Affects Versions: 3.3.0.ga
>            Reporter: Stephen R. Saucier
>            Priority: Minor
>         Attachments: checkForOrphanProperties.patch
>
>
> According to the EJB3 spec, section 2.1.1 (Persistent Fields and Properties), "property accessor methods must be public or protected." However, the checkForOrphanProperties method of org.hibernate.cfg.annotations.reflection.EJB3OverridenAnnotationReader only looks for public methods (by virtue of the fact that it is using the getMethods method of Class. I believe that the checkForOrphanProperties method ought to look at the protected methods implemented in the entity class as well in order to eliminate the erroneous warning messages that are reported when using hibernate with protected property accessor methods.
> I've attached a patch which implements this additional behavior.

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