Reputation: 19579
I have a Mysql table with a field name "password", I have set this field is NOT NULL in mysql.
but hibernate always insert empty string to my table.
so, I wander if there is a way to config hibernate treat empty string as null and let mysql throw an error that the field is not allow to be NULL.
Upvotes: 0
Views: 1733
Reputation: 587
Try adding a constraint to your password field by using the @NotBlank annotation.
Upvotes: 2