[hibernate-issues] [Hibernate-JIRA] Resolved: (BVAL-72) Validating an object multiple times if in a different branch of the graph

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Mar 5 18:42:48 EST 2009


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

Emmanuel Bernard resolved BVAL-72.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0 proposed final draft

> Validating an object multiple times if in a different branch of the graph
> -------------------------------------------------------------------------
>
>                 Key: BVAL-72
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-72
>             Project: Bean Validation
>          Issue Type: Improvement
>          Components: spec-general
>            Reporter: Emmanuel Bernard
>             Fix For: 1.0 proposed final draft
>
>
> 3-F) 3.5.1 "The InvalidConstraint objects reflect the path to reach the
> object from the root validated object": What happens if the same invalid
> object is referenced twice by an object (see the example below). Will
> there be generated two InvalidConstraint objects one reflecting the path
> b.ref1.value and one for b.ref2.value? If the referenced invalid object
> is only validated once, which property path will be used?
> class A {
>  @NotNull String value = null;
> }
> class B {
> @Valid A ref1;
> @Valid A ref2;
> }
> b = new B();
> b.ref1 = new A();
> b.ref2 = ref1;
> Only one ConstraintViolation is created.
> from 3.1.3
> The @Valid annotation is applied recursively. A conforming
> implementation avoids infinite loops by validating an 
> object the first time it is encountered in the graph, and ignores it
> if it is encountered through at different path. 
> The path chosen is not defined. Any alternative?
> Fine with me, I just wanted to have that clarified.
> I thought about that a bit.
> We have the current rule wich is simple but a bit indeterministic in the case an object is referenced twice in an object graph
> Or we could adopt the following rule
> For a given object graph branch, the same instance cannot be validated several times.
> This would lead to the validation of the same object several times provided it is in different branches
> in Sebastian's example
> b.ref1 and b.ref2 would be validated and generate the same constraintViolations (with different paths)
> Opinions?
> - only one validation pass per instance (with some indeterminism)
> - several validation pass and error reports provided that the object graph branches are different?

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