This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When generating JPA entities from a PostgreSQL database schema, NetBeans creates identity fields like: @Id @SequenceGenerator @GeneratedValue(strategy = GenerationType.AUTO) @Basic(optional = false) @NotNull @Column(name = "id") private Integer id; What it should really do for PostgreSQL is examine primary keys to see if there's a default of `nextval('some_seq_name')' and if there is, define the column as: @Id @SequenceGenerator(name="the_seq_name", sequenceName="the_seq_name", allocationSize=1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="the_seq_name") @Basic(optional = false) @NotNull @Column(name = "id") private Integer id; This will ensure that the correct PostgreSQL sequence is used to allocate IDs. Note that the `allocationSize=1' is important to avoid another issue where JPA implementations will incorrectly assume the result of `nextval' is the highest of 50 allocated IDs. A correct value for `allocationSize' can be derived by examining `INFORMATION_SCHEMA.SEQUENCES' for the `increment' value of the sequence of interest. I was a little surprised that there doesn't seem to be an obvious link in INFORMATION_SCHEMA between a generated column in a table and the associated sequence.
It will be useful feature for oracle db also.