I added a new domain class to my project, and when call the method to add a new instance to the table, throw a strange error.
This is the call: (a simple save and print errors if not)
if (!distributor.save()) {
flash.error = message(code: 'unexpectedError')
distributor.errors.each {
println it
}
}
This is the stacktrace: (only the caused by portion)
Caused by: java.sql.SQLException: Field 'version' doesn't have a default value
Does someone got this error? I don't understand why this is happening because version
is a auto-generated field by Grails/Hibernate framework.
I tried to delete the table and recreate it but still getting the same error. Could that be an bug? I don't think that i am doing wrong because is not my first table or relationship in the project.
Any help will be appreciated.