Hibernate @NotBlank vs @NotEmpty

by kiawin



Sometimes we may often overlook at the difference between these two useful annotations for Hibernate. @NotBlank versus @NotEmpty.

Validate that the annotated string is not null or empty. The difference to NotEmpty is that trailing whitespaces are getting ignored.

The answer can be found at Hibernate Doc for @NotBlank :)