Reputation: 766
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
Upvotes: 0
Views: 516
Reputation: 11
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.
Upvotes: 1