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:

  1. Open the entity class for the table that has the identity column.
  2. Add the following annotation below the line with the @ID annotation:

  Applies to: NetBeans IDE 6.x
  Platforms: All
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo