Hello, I'm developing a system with javax.validation and the hibernate-jpa-2.0-api.
I have the following scenrio:
Code:
@Entity
@Table(name="ath_login", uniqueConstraints = {@UniqueConstraint(columnNames={"name"})})
public class Login {
public enum Status {OK, NEW, BLOCKED, CLOSED}
@Size(min=7, max=255)
@NotNull
@Column(name="name", length=255)
protected String name;
@Size(min=6, max=50)
@Column(name="password", length=32)
protected String password;
// getters and setters
}
public class WebLogin extends Login {
}
I want that the name field of WebLogin class is validated by
@Pattern(regexp = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[a-zA-Z]{2,4}$" , message="Bad Email")
How can I do it?