Hi all.
I have annotated some POJO's fields with validation tags. It works fine, but the message I receive when the exception is raised is not enough intuitive. Is (easy) possible to specify a text message for each field annotation?.
E. g.:
Code:
public class AnnotatedPojo implements Serializable {
// other fields and getter/setter...
private String date = null;
@Pattern(regex = Utils.DATE_REGEXP)
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
In this case, if the text written in 'date' field does not match the regular expression, Hibernate raises an error but it does not specify which is exactly the problem. I would like to indicate, at least, the field name and the source of the problem ("date format" or something similar).
Any idea?