0

I have a web MVC project generated by Spring roo. I reverse engineered a MSSQL DB and have the need to create my own primary keys but am unable to insert using the inputs Roo generated (anticipates an auto increment or self-generated ID). Any ideas? I recieve the below message from the console when I attempt this.

ERROR org.hibernate.util.JDBCExceptionReporter - Field 'id' doesn't have a default value

1 Answer 1

1

It appears that the DBRE code generation for @ManyToOne/@JoinColumn is a bit incorrect. The code generator incorrectly sets such a field with "insertable = false" which then omits this particular foreign key column reference during an insert into the referencing table. Change it to "insertable = true" as well as the "updateable" if you require and you should be good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.