Fixed
Details
Details
Assignee
Emmanuel Bernard
Emmanuel BernardReporter
Gunnar Morling
Gunnar MorlingParticipants
Emmanuel Bernard
Gunnar Morling
Hardy Ferentschik
Components
Fix versions
Affects versions
Priority
Created April 21, 2011 at 11:04 PM
Updated January 13, 2015 at 8:07 PM
Resolved June 1, 2012 at 10:16 AM
As of version 1.0 the specification does not clearly state, whether the static or the runtime type of an association should be considered when creating property paths in case of cascaded validations.
Let there be the following type:
When validating an instance of Foo (which has invalid elements in bar1/bar2) with the RI, the resulting property path node for bar1 would be iterable but not indexable ("bar1[]"), while the property path node for bar2 would be iterable and indexable ("bar2[123]"). This is that way because the static type of bar1/bar2 (Collection vs. List) is considered by the RI when building the nodes, and not the runtime type (ArrayList in both cases).
According to a post [1] on the Hibernate Validator forum Apache's JSR 303 implementation follows the runtime type approach. This seems reasonable to me, too (as for instance the constraints to validate are also determined based on the runtime type of references).
The specification should make clear what the intended behavior is and provide a TCK test case.
[1] related forum post: https://forum.hibernate.org/viewtopic.php?f=9&t=1010626
[2] related discussion on hibernate-dev: http://lists.jboss.org/pipermail/hibernate-dev/2011-April/006357.html