0 Replies Latest reply on Oct 23, 2008 3:39 PM by Franco Fernandes

    Stop hibernate validation after first error

    Franco Fernandes Novice


      I asked this question on the Hibernate forum and got no response. Hopefully some Seam user can guide me.


      I have a custom hibernate validator as

      @Pattern(regex="^\\d*$", message="{validator.custom.digits}")
      @Length(min = 5, max = 10)
      @UniqueSimpleKey (tableName = "TAX", pkColumnName = "TAX_CODE")
      public String getTaxCode() {
           return this.taxCode;

      My last validator is a custom validator that fires a SQL query to check if the code entered already exists. The problem is that Hibernate will run this validation even if the validations prior to this one fail. Is there a switch to control this ?

      Alternatively, does anyone know how to gracefully handle duplicate key checks ?