Hibernate @NotEmpty annotation equivalent in Javax.package or alternative

Kevin Rave picture Kevin Rave · Jul 5, 2013 · Viewed 41.9k times · Source

Is there a way to implement @NotEmpty hibernate validation without writing custom validation? javax.validation package does not contain this annotation. Only @NotNull. But it does not validate for Non-null but empty values. So I would like to see an alternative for @NotEmpty.

Using @Pattern? How?

Answer

Affe picture Affe · Jul 5, 2013

NotEmpty is just a combination of @NotNull and @Size(min=1).