Subject | Primary key column marked as unique in reverse-engineering using hibernate tools |
---|---|
Author | vkozlov_tk |
Post date | 2009-07-21T15:32:41Z |
When I perform reverse-engineering of a Firebird database using
hibernate tools, the primary key column is annotated as unique:
CREATE TABLE OBJCLASS (
IDOBJCLASS INTEGER NOT NULL,
NAME VARCHAR(250),
SYSNAME VARCHAR(250) NOT NULL,
IDOBJCLASSPARENT INTEGER
);
ALTER TABLE OBJCLASS ADD PRIMARY KEY (IDOBJCLASS);
generates code for primary key:
@SequenceGenerator(name = "generator", sequenceName = "GENERATOR_ID")
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "generator")
@Column(name = "IDOBJCLASS", unique = true, nullable = false)
public Integer getIdobjclass() {
return this.idobjclass;
}
and when I trying to recrerate database via hbm2ddl, the error occurs:
1485 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - GDS
Exception. 335544351. unsuccessful metadata update
Same set of columns cannot be used in more than one PRIMARY KEY and/or
UNIQUE constraint definition
The similar issue described here:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-978
Is there any way to suppress generation of "unique = true" for PK
column?
[Non-text portions of this message have been removed]
hibernate tools, the primary key column is annotated as unique:
CREATE TABLE OBJCLASS (
IDOBJCLASS INTEGER NOT NULL,
NAME VARCHAR(250),
SYSNAME VARCHAR(250) NOT NULL,
IDOBJCLASSPARENT INTEGER
);
ALTER TABLE OBJCLASS ADD PRIMARY KEY (IDOBJCLASS);
generates code for primary key:
@SequenceGenerator(name = "generator", sequenceName = "GENERATOR_ID")
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "generator")
@Column(name = "IDOBJCLASS", unique = true, nullable = false)
public Integer getIdobjclass() {
return this.idobjclass;
}
and when I trying to recrerate database via hbm2ddl, the error occurs:
1485 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - GDS
Exception. 335544351. unsuccessful metadata update
Same set of columns cannot be used in more than one PRIMARY KEY and/or
UNIQUE constraint definition
The similar issue described here:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-978
Is there any way to suppress generation of "unique = true" for PK
column?
[Non-text portions of this message have been removed]