<div><div><div>hi,</div><div><br></div><div>actually we had a related discussion about it for bv v1.0.</div><div>(the topic was &quot;sort-circuit&quot; and one suggestion was to introduce e.g. ValidatorContext#failAtFirstViolation)</div>

<div><br></div><div>+1 for re-visiting this topic.</div><div><br></div><div>regards,</div><div>gerhard</div></div><div><br></div><div><br></div><div><br></div></div><div><div class="gmail_quote">2012/1/3 Cemo <span dir="ltr">&lt;<a href="mailto:cemalettin.koc@gmail.com">cemalettin.koc@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi experts,<div><br></div><div>After reading your comments and mail list I realized that it will be better share our opinions here about our problems.</div>

<div><br></div><div>First, I would like to thanks all of you to provide such an elegant library and spec. After latest improvements at spring side, I am sure that bean validation will be defacto validation framework among java community.</div>



<div><br></div><div>The only problem We are facing is that ordered validations.</div><div><br></div><div>In a common sense validation such this can be feasible: </div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<pre style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;font-size:1.2em;line-height:1.3em;max-height:30em;word-wrap:normal;text-align:left;background-color:rgb(240,240,240)">

<span style="background-color:inherit;color:rgb(0,0,145)">public</span> class AccountBean {

   @CheapValidation(groups=Name1.class)
   @ExpensiveValidation(groups=Name2.class)
   @VeryExpensiveValidation(groups=Name3.class)
   <span style="background-color:inherit;color:rgb(145,0,145)">String</span> name;

   @CheapValidation(groups=Surname1.class)
   @ExpensiveValidation(groups=Surname2.class)
   @VeryExpensiveValidation(groups=Surname3.class)
   <span style="background-color:inherit;color:rgb(145,0,145)">String</span> surname;

   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Name1 {}
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Name2 {}
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Name3 {}
   @GroupSequence({Name1.class, Name2.class, Name3.class})
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Name {}

   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Surname1 {}
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Surname2 {}
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Surname3 {}
   @GroupSequence({Surname1.class, Surname2.class, Surname3.class})
   <span style="background-color:inherit;color:rgb(0,0,145)">public</span> <span style="background-color:inherit;color:rgb(0,0,145)">interface</span> Surname {}
}</pre></blockquote><div><br></div><div><br></div><div>There is two common usage for this. The first usage: some validations are expensive that should be runned if all validations pass. Another usage is for each field there should be one violation. For email, if it is empty, uniqueEmail constraint must not be checked. I hope that how much necessary it is for us you can imagine. Almost all fields has such restrictions. Ordering and shortcutting are crucial for us.</div>



<div><br></div><div>But just to provide validation order and shortcut GroupSequence is practically  impossible to use at enterprice level. For each field again and again we are declaring interfaces. It is not only intuitive but also seems ugly. By the way what is came to my mind is for each constraint, declaring a order like this:</div>



<div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<pre style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;font-size:1.2em;line-height:1.3em;max-height:30em;word-wrap:normal;text-align:left;background-color:rgb(240,240,240)">

<span style="background-color:inherit;color:rgb(0,0,145)">public</span> class AccountBean {

   @CheapValidation(order=0,groups=Name1.class)
   @ExpensiveValidation(order=1,groups=Name2.class)
   @VeryExpensiveValidation(order=2,groups=Name3.class)
   <span style="background-color:inherit;color:rgb(145,0,145)">String</span> name;

   @CheapValidation(order=0,groups=Surname1.class)
   @ExpensiveValidation(order=1,groups=Surname2.class)
   @VeryExpensiveValidation(order=2,groups=Surname3.class)
   <span style="background-color:inherit;color:rgb(145,0,145)">String</span> surname;
}</pre></blockquote><div><br></div><div>Default value for ordering might be same for all constraints.</div><div><br></div><div>Please help community. :) </div><div><br></div><div>Thanks &amp; happy new year  </div>
<br>_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<br></blockquote></div><br></div>