]
Hardy Ferentschik updated HV-433:
---------------------------------
Component/s: engine
Cascaded validation on superclass fields does not work if only @valid
is used
-----------------------------------------------------------------------------
Key: HV-433
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-433
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Environment: Java 1.5.0 (IBM J9 2.3); Hibernate Validator 4.1.0.FINAL
Reporter: Christian Quanz
Cascaded fields are not validated if the following applies:
- Only @valid is specified for a particular field, no further constraints
- Validation takes place on an object of a sublcass of the class where the field to be
validated is defined
Simply no validation will take place on the object assigned to the field. Eyerything
works fine if I add another constraint definition, e.g., @NotNull to the field, as in the
examples in the documentation. If I validate an object of the class where the field is
defined, it also works. I doubt that it matters, but the field's visibility is
"protected".
I tested it for XML constraint definitions and programmatic constraint definitions.
I could trace the error back to BeanMetaDataImpl->initFieldConstraints(...), where the
flag cachedFieldIsCascaded will be false. Thus, addCascadedMember(...) will not be called
for the field.
In case of any additional constraint being defined, the flag cachedFieldIsCascaded will
be true.
Hope that helps.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: