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