Hi Hardy,<div><br></div><div>thanks for these pointers. I'm confused by the description of this case (3) in HV-164, though. There it says:</div><div><br></div><div>"<span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">when validating Default.class on B, you need to validate sequentially</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">* @Max on size (Minimal)</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">* @Size on name (A)</span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">* and in // at any time @Size on nickname (B group)."</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">What does "in/at any time" mean here?</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">The description further says:</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">"Likewise @Max on size could fail [...] [and] @Size on nickname (B) will not </span><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">[be validated] </span><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">as it has to be validated only if Minimal constraints pass".</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">But the test in the TCK expects two violations, one for @Max on size and one for @Size on nickname. This seems to be contradictory.</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">My actual question is also why the rules are like this. So what's the rationale of not applying the default sequence from the super type to the constraints of the sub-type?</span><br>
</div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">Whenever I'm starting to think about re-defined default group sequences, I'm getting confused :)</span></div>
<div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:13px;line-height:17px">--Gunnar</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/8 Hardy Ferentschik <span dir="ltr"><<a href="mailto:hardy@hibernate.org" target="_blank">hardy@hibernate.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
The isolation of the group sequence is captured in this discussion [1] and this HV issue [2]<br>
<br>
--Hardy<br>
<br>
[1] <a href="http://lists.jboss.org/pipermail/hibernate-dev/2009-May/003891.html" target="_blank">http://lists.jboss.org/pipermail/hibernate-dev/2009-May/003891.html</a><br>
[2] <a href="https://hibernate.onjira.com/browse/HV-164" target="_blank">https://hibernate.onjira.com/browse/HV-164</a><br>
<div><div><br>
On 8 Jan 2012, at 1:15 PM, Gunnar Morling wrote:<br>
<br>
> Hi experts,<br>
><br>
> I've got a question regarding the re-definition of default group sequences in inheritance hierarchies, more specifically about the test method GroupSequenceIsolationTest#testCorrectDefaultSequenceInheritance3() in the TCK [1].<br>
><br>
> There are the following two classes and validation groups defined:<br>
><br>
> @GroupSequence({ Minimal.class, A.class })<br>
> public class A {<br>
><br>
> @Max(value = 10, groups = Minimal.class)<br>
> int size;<br>
><br>
> @Size(max = 20)<br>
> String name; //A group<br>
> }<br>
><br>
> interface Minimal {}<br>
><br>
> interface Heavy {}<br>
><br>
> public class B3 extends A {<br>
><br>
> @SafeEncryption(groups = Heavy.class)<br>
> String encryptionKey;<br>
><br>
> @Size(max = 20)<br>
> String nickname;<br>
> }<br>
><br>
> The test looks like this:<br>
><br>
> B3 b = new B3();<br>
><br>
> //all values invalid<br>
> <a href="http://b.name" target="_blank">b.name</a> = "this name is too long";<br>
> b.nickname = "and this nickname as well";<br>
> b.size = 20;<br>
> b.encryptionKey = "not safe";<br>
><br>
> Set<ConstraintViolation<B3>> violations = validator.validate( b );<br>
> assertCorrectNumberOfViolations( violations, 2 );<br>
> assertCorrectConstraintTypes( violations, Max.class, Size.class );<br>
> assertCorrectPropertyPaths( violations, "size", "nickname" );<br>
><br>
> So, based on the assertions, the re-defined default group sequence only applies to the constraints defined on A but not on those defined on B3.<br>
><br>
> I'm wondering why that is. Intuitively I would have expected that the re-definition of the default group applies to all types of the hierarchy, so one can re-define the default group at the top of an inheritance hierarchy.<br>
><br>
> Does anyone know/remember why the behavior is defined like it is?<br>
><br>
> Thanks,<br>
><br>
> --Gunnar<br>
><br>
> [1] <a href="https://github.com/beanvalidation/beanvalidation-tck/blob/master/tests/src/main/java/org/hibernate/beanvalidation/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java#L134" target="_blank">https://github.com/beanvalidation/beanvalidation-tck/blob/master/tests/src/main/java/org/hibernate/beanvalidation/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java#L134</a><br>
><br>
</div></div>> _______________________________________________<br>
> beanvalidation-dev mailing list<br>
> <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">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>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">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>
</blockquote></div><br></div>