FaqDesktopDatabaseIdentityColumn
How do I use an IDENTITY column in a Java Desktop Application?
If you get an error when trying to save a new record in a Java Desktop Application created with the Database Application shell on a database that has an IDENTITY column, it might be because the New Project wizard did not generate the correct annotation in the entity class.
To fix:
- Open the entity class for the table that has the identity column.
- Add the following annotation below the line with the @ID annotation:
@GeneratedValue(strategy=GenerationType.IDENTITY)
Applies to: NetBeans IDE 6.x
Platforms: All