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

    Stop hibernate validation after first error

      Hi


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


      http://forum.hibernate.org/viewtopic.php?t=991725&sid=d3467a39a5774ef64ec8873506411b22


      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 ?


      Thanks
      Franco