I have used @NotNull annotation on Java bean class for JSF in register page. But it is not working as expceted.
Here is my xhtml page part :
User Name : <h:inputText value="#{user.userName}" />
And here is my Java bean part :
@NotNull(message = "User name cannot be null")
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
But it still save userName to database(PostgreSQL) as ''. So technically it is not null. I know may be I must also make not null that column on database. But what for we use @NotNull annotation then?