Today i’ve got an exception when JPA was trying to insert a new row to a table.
My model definition was like this:
And the table creation script was the following:
I faced some strange exceptions like id could not be null, SQL error or missing database (near “values”: syntax error), etc.
The solution to this consists of two steps:
- in database: remove the AUTOINCREMENT and NOT NULL annotations from the ID column as SQLite will automatically increment its value (in DB)
- in entity’ code: remove the GenerationStrategyType from the id member annotation