Hi Hardy,<div><br></div><div>thanks for these pointers. I&#39;m confused by the description of this case (3) in HV-164, though. There it says:</div><div><br></div><div>&quot;<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).&quot;</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 &quot;in/at any time&quot; 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">&quot;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&quot;.</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&#39;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&#39;m starting to think about re-defined default group sequences, I&#39;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">&lt;<a href="mailto:hardy@hibernate.org" target="_blank">hardy@hibernate.org</a>&gt;</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>
&gt; Hi experts,<br>
&gt;<br>
&gt; I&#39;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>


&gt;<br>
&gt; There are the following two classes and validation groups defined:<br>
&gt;<br>
&gt; @GroupSequence({ Minimal.class, A.class })<br>
&gt; public class A {<br>
&gt;<br>
&gt;     @Max(value = 10, groups = Minimal.class)<br>
&gt;     int size;<br>
&gt;<br>
&gt;     @Size(max = 20)<br>
&gt;     String name; //A group<br>
&gt; }<br>
&gt;<br>
&gt; interface Minimal {}<br>
&gt;<br>
&gt; interface Heavy {}<br>
&gt;<br>
&gt; public class B3 extends A {<br>
&gt;<br>
&gt;     @SafeEncryption(groups = Heavy.class)<br>
&gt;     String encryptionKey;<br>
&gt;<br>
&gt;     @Size(max = 20)<br>
&gt;     String nickname;<br>
&gt; }<br>
&gt;<br>
&gt; The test looks like this:<br>
&gt;<br>
&gt; B3 b = new B3();<br>
&gt;<br>
&gt; //all values invalid<br>
&gt; <a href="http://b.name" target="_blank">b.name</a> = &quot;this name is too long&quot;;<br>
&gt; b.nickname = &quot;and this nickname as well&quot;;<br>
&gt; b.size = 20;<br>
&gt; b.encryptionKey = &quot;not safe&quot;;<br>
&gt;<br>
&gt; Set&lt;ConstraintViolation&lt;B3&gt;&gt; violations = validator.validate( b );<br>
&gt; assertCorrectNumberOfViolations( violations, 2 );<br>
&gt; assertCorrectConstraintTypes( violations, Max.class, Size.class );<br>
&gt; assertCorrectPropertyPaths( violations, &quot;size&quot;, &quot;nickname&quot; );<br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; I&#39;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>


&gt;<br>
&gt; Does anyone know/remember why the behavior is defined like it is?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; --Gunnar<br>
&gt;<br>
&gt; [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>


&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; beanvalidation-dev mailing list<br>
&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; <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>