It appears that the Hibernate NotEmpty
annotation does not result in an error for strings filled with whitespace (" "
). Only works for nulls or empty strings (ie: new String()
). Is there a workaround/fix for this?
@NotEmpty is used to check size rather than contents and applies to Collections as well as Strings. The functionality you're looking for is provided in @NotBlank which is specific to Strings and ignores trailing whitespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With