[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-64) Field annotated member validators does not work with proxied objects

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Aug 11 18:29:09 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HV-64?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard resolved HV-64.
--------------------------------

    Resolution: Won't Fix

I cannot apply your patch as it breaks a lot of semantics on what to expect.

> Field annotated member validators does not work with proxied objects
> --------------------------------------------------------------------
>
>                 Key: HV-64
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-64
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 3.0.0.ga, 3.1.0.CR1
>            Reporter: Lucien Weller
>         Attachments: getter-fix.patch
>
>
> Every thing works fine, except when I try to validate an persistent instance laded directly from database (which should obviously be valid) we get some invalid values reported by hibernate class validator.
> After debuging hibernate validator code, I discovered that it is because we annotate our hibernate classes on field level with validator anotaions (getter and setter are generated in our project). Hibernate validator then tries to retrive the value directly by accessing the field it self. But if the instance is a proxied object (due to lazy loading), fields don't hold the correct value (in fact they all set to null) and validator then reports an invalid value if field is annotated with not null validator.
> I simply fixed this isse by accessing fields with their getter rather than by a direct access if a getter has been defined. Now validation also works fine with persistent proxied instances loaded from database.
> The corresponding patch is attached to the present issue report, hoping this will be fixed in 3.1.0.GA release

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