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.

Bug 118275 - Entity classes from Database wizard does not generate @GeneratedValue(strategy=GenerationType.IDENTITY) for identity column
Summary: Entity classes from Database wizard does not generate @GeneratedValue(strateg...
Status: RESOLVED DUPLICATE of bug 87023
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-09 17:53 UTC by Girish Balachandran
Modified: 2007-10-10 11:17 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Girish Balachandran 2007-10-09 17:53:37 UTC
Entity classes from Database wizard does not generate @GeneratedValue(strategy=GenerationType.IDENTITY) for identity column.

If a table has 
CREATE TABLE(ID BIGINT generated always as identity NOT NULL);

the wizard generated code now is:

@Id
@Column(name = "ID", nullable = false)
private BigInteger id;

It should be this:

@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
private BigInteger id;

Otherwise, JPA exceptions will be thown when a new row is added to this table via JPA persistance.
Comment 1 Andrei Badea 2007-10-10 11:17:40 UTC

*** This issue has been marked as a duplicate of 87023 ***