Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Bug in DDL generation for Oracle
Bug in DDL generation for Oracle [message #520633] Sat, 13 March 2010 09:04 Go to previous message
Andrew Hume is currently offline Andrew Hume
Messages: 18
Registered: December 2009
Junior Member
If a column is marked as unique (@Column(unique=true,...)) then the DDL generated for the primary key column is UNIQUE NOT NULL. The inclusion of UNIQUE causes Oracle to complain with ORA-02261: such unique or primary key already exists in the table.

Removing unique=true from the @Column avoids the problem, but is this the correct answer? When EclipseLink reverse engineers a database table it assigns unique=true to primary key columns.

Suggest that the DDL generation code should not emit UNIQUE for Oracle.

Thoughts?

@Entity
@Table(name="ACCOUNT")
public class Account implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@SequenceGenerator(name="ACCOUNT_ACCOUNTID_GENERATOR", sequenceName="SEQ_ACCOUNT_ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ACCOUNT_ACCOUNTID_GENERATOR")
@Column(unique=true, nullable=false, precision=22)
private long accountid;

produces

CREATE TABLE ACCOUNT (ACCOUNTID NUMBER(22) UNIQUE NOT NULL, ...., PRIMARY KEY (ACCOUNTID))

Andrew
 
Read Message
Read Message
Previous Topic:Private Ownership and Unique Constraints
Next Topic:Fetch Join Problem
Goto Forum:
  


Current Time: Thu May 23 07:00:55 EDT 2013

Powered by FUDForum. Page generated in 0.01687 seconds