[hibernate-issues] [Hibernate-JIRA] Commented: (BVAL-226) Make clear whether the static or the runtime type should be considered when creating property paths in case of cascaded validations

Gunnar Morling (JIRA) noreply at atlassian.com
Mon Sep 26 16:49:35 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/BVAL-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43696#comment-43696 ] 

Gunnar Morling commented on BVAL-226:
-------------------------------------

Must have.

> Make clear whether the static or the runtime type should be considered when creating property paths in case of cascaded validations
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-226
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-226
>             Project: Bean Validation
>          Issue Type: Improvement
>          Components: spec-general
>    Affects Versions: 1.0 final
>            Reporter: Gunnar Morling
>             Fix For: 1.1
>
>
> 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:
> {code:java}
> class Foo {
>    private Collection<Bar> bar1 = new ArrayList<Bar>();
>    private List<Bar> bar2 = new ArrayList<Bar>();
> }
> {code}
> 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/006359.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list