I've been scratching my head over this error for sometime now but can't work it out. I've been using Hibernate 3 to persist User entity. But I am getting java.sql.SQLException: Field 'passwordConfirmation' doesn't have a default value error when I try to do that.
Following is my User entity:
User.java
Could someone help me understand that why am I getting this error?
The only entity that I have is User entity and the schema was generated using Hibernate itself. Although it should not be a problem but even after removing @NotEmpty from passwordConfirmation fields, it still gives me the same error. I am using spring mvc 3 with hibernate 3. I am using User entity to represent the form and after submitting the form I find the model populated with the respective fields properly.
Could you post the complete stack trace.
The exception is not caused by @NotEmpty, from what you have poseted it seems like a SQL exception thrown by database
Try removing @Transient from passwordConfirmation
Check the table creation script, this column has a default value set, try removing it.
I was mistakenly using a different schema than the one I was generating using Hibernate. Both the schema had passwordConfirmation field in the User entity so got confused.