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
eric MC
  • 766
  • 2
  • 10
  • 36

1 Answers1

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.

Sastry
  • 11
  • 1