Javax empty integer field validation
I suggest you to use the object type Integer
which can hold the null value itself.
@Column(name = "salary", nullable = false)
@NotNull(message= "salary may not be empty")
@Range(min = 1)
private Integer salary;
The above secures there will be always the salary
input that has a value and it's equal or greater than 1.