Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-3328

Hibernate Validator: default group sequence does not honor group hierarchy

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: 7.0.0.ER4
    • Fix Version/s: 7.0.0.ER6
    • Component/s: Hibernate
    • Labels:
      None
    • Target Release:
    • Steps to Reproduce:
      Hide

      See description

      Show
      See description
    • Workaround Description:
      Hide

      Workaround is to list the full group hierarchy in the constraint declarations

      @GroupSequence({Max.class, A.class})
      public class A {
          @NotNull(groups={Min.class, Max.class})
          public String foo;
      
          @NotNull(groups=Min.class)
          public String bar;
      }
      
      Show
      Workaround is to list the full group hierarchy in the constraint declarations @GroupSequence({Max.class, A.class}) public class A { @NotNull(groups={Min.class, Max.class}) public String foo; @NotNull(groups=Min.class) public String bar; }

      Description

      Customer discovered an issue in EAP 6 that needs to be fixed on both streams.

      Default group sequence does not honor group inheritance rules.

      public interface Min {}
      
      public interface Max extends Min {}
      
      @GroupSequence({Max.class, A.class})
      public class A {
          @NotNull(groups=Max.class)
          public String foo;
      
          @NotNull(groups=Min.class)
          public String bar;
      }
      
      public class B {
          @NotNull(groups=Max.class)
          public String foo;
      
          @NotNull(groups=Min.class)
          public String bar;
      }
      

      The following code returns as expected

      assert validator.validate(new B(), Max.class, A.class).size() == 2
      

      But the following fails

      // bar is ignored as Min is not considered when Max is evaluated for default sequence
      // so size == 1
      assert validator.validate(new A(), Max.class, A.class).size() == 2
      

      More information at https://hibernate.atlassian.net/browse/HV-1055

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  smarlow Scott Marlow
                  Reporter:
                  epbernard Emmanuel Bernard
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: