[hibernate-issues] [Hibernate-JIRA] Created: (BVAL-255) Simplify GroupSequence for ordered checking

Cemo Koc (JIRA) noreply at atlassian.com
Thu Dec 29 02:53:19 EST 2011


Simplify GroupSequence for ordered checking
-------------------------------------------

                 Key: BVAL-255
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-255
             Project: Bean Validation
          Issue Type: New Feature
          Components: spec-general
    Affects Versions: 1.0 final
            Reporter: Cemo Koc


The JSR 303 is becoming defacto solution at enterprise level projects however I think that it has a significant useless part. The current implementation states group sequence must be utilized to ordered validation. In order to use group sequence, one has to define interfaces for each order sequence such this:


{code}
public class AccountBean {

   @CheapValidation(groups=Name1.class)
   @ExpensiveValidation(groups=Name2.class)
   @VeryExpensiveValidation(groups=Name3.class)
   String name;

   @CheapValidation(groups=Surname1.class)
   @ExpensiveValidation(groups=Surname2.class)
   @VeryExpensiveValidation(groups=Surname3.class)
   String surname;

   public interface Name1 {}
   public interface Name2 {}
   public interface Name3 {}
   @GroupSequence({Name1.class, Name2.class, Name3.class})
   public interface Name {}

   public interface Surname1 {}
   public interface Surname2 {}
   public interface Surname3 {}
   @GroupSequence({Surname1.class, Surname2.class, Surname3.class})
   public interface Surname {}
}
{code}


Look the code how it is ugly and useless. What I am offering is a simplified version of ordering such this:

{code}
public class AccountBean {

   @CheapValidation(order=0,groups=Name1.class)
   @ExpensiveValidation(order=1,groups=Name2.class)
   @VeryExpensiveValidation(order=2,groups=Name3.class)
   String name;

   @CheapValidation(order=0,groups=Surname1.class)
   @ExpensiveValidation(order=1,groups=Surname2.class)
   @VeryExpensiveValidation(order=2,groups=Surname3.class)
   String surname;
}
{code}

Almost all enterprise projects needs such kind of things. For example lets say that you want to validate email field by NotEmpty and UniqueAtDatabase. Why should we show two error messages in this case? Shortly, to increase usability and adaptability please solve this issue. 

PS: This issue is cross posted here and forums.

https://forum.hibernate.org/viewtopic.php?f=26&t=1007328

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list