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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 7.0.0.ER6
    • 7.0.0.ER4
    • Hibernate
    • None
    • 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; }
    • Hide

      See description

      Show
      See description

    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

      Attachments

        Issue Links

          Activity

            People

              smarlow1@redhat.com Scott Marlow
              rhn-engineering-ebernard Emmanuel Bernard
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: