Hibernate @NotBlank vs @NotEmpty

by kiawin

4812269151_9e0413a8db_z

 

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 :)