Hello,

Just want to know if there's a way to make the regular expression from Hibernate to be configurable (i.e. the regex is derived from database or configuration file).
I have this code:

@Column(name = "MYCOLUMN", length = 20)
@Length(max = 20)
@Pattern(regex = "^01[0-9]{15}$", message = "#{messages['error.invalid']}")
public String getMyColumn() {
return this.myColumn;
}

From the code above, can I make the regex configurable (^01[0-9]{15}$)? Is it possible to put this regex from database or configuration file so when this changes, I just need to change the database or the configuration file and not the code itself.

If it's possible, please let me know how this can be done and how to apply it in the code above. Thanks in advance!