-
August 31st, 2010, 11:33 PM
#1
Configurable Regular Expression in Hibernate
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|