I am working with hibernate framework and I want to apply hibernate constraint on my @Entity class. I want to execute/run constraint on it's order/sequence as define inside @Entity class.
@Entity
@Table(name = "User")
public class User{
@NotNull
@NotBlank
@Pattern(regexp = "[a-zA-Z]+")
@Length(max = 10)
private String firstName;
}
I want to execute constrain as below order:
1) @NotNull
2) @NotBlank
3) @Pattern(regexp = "[a-zA-Z]+")
4) @Length(max = 10)
Any one please help me how can I achieve it. I also want to apply constrain order/sequence on more than one field.