Hi
I have a field which serves as the unique identifier for my entity.
Code:
@Column(name = "TAX_CODE")
@NotNull
@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 entered tax code already exists in the table.
My problem is that Hibernate fires all the validators and then reports errors for the first one that failed validation. So my sql query in the custom validator runs every time until all other validations are passed.
Ouch !
Can someone offer advice how to handle this situation?
Thanks
Franco