[
http://jira.jboss.com/jira/browse/JBSEAM-1820?page=all ]
Ali Sadik Kumlali updated JBSEAM-1820:
--------------------------------------
JBoss Forum Reference:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116478
Description:
- Create PEOPLE table using following script:
CREATE TABLE PEOPLE ("ID" NUMBER NOT NULL, "SURNAME" VARCHAR2(50
BYTE), "NAME" VARCHAR2(25 BYTE), CONSTRAINT "PEOPLE_PK" PRIMARY KEY
("ID"));
- Generate entities:
c:\seam>seam generate-entities
- Annotation of primary key column(ID) found in People.java should have "unique =
true" attribute:
@Id
@Column(name = "ID", unique = true, nullable = false, precision = 22,
scale = 0)
@NotNull
public BigDecimal getId() {
return this.id;
}
- Drop the PEOPLE table:
DROP TABLE "PEOPLE" CASCADE CONSTRAINTS;
- To force the schema to be generated from entity classes, redeploy application:
c:\seam\examples\people_sample>ant
- Dig inside the server logs. You should see an error:
02:00:36,956 INFO [SchemaExport] Running hbm2ddl schema export
02:00:36,959 INFO [SchemaExport] exporting generated schema to database
02:00:37,215 ERROR [SchemaExport] Unsuccessful: create table PEOPLE (ID number(22,0)
not null unique, NAME varchar2(25 c
har), SURNAME varchar2(50 char), primary key (ID))
02:00:37,217 ERROR [SchemaExport] ORA-02261: such unique or primary key already
exists in the table
- Remove unique=true attribute from @Column annotation and compile/redeploy the
application. You should see table PEOPLE is created and logs are fine.
was:
Following steps causes
- Create a table using following script:
CREATE TABLE PEOPLE ("ID" NUMBER NOT NULL, "SURNAME" VARCHAR2(50
BYTE), "NAME" VARCHAR2(25 BYTE), CONSTRAINT "PEOPLE_PK" PRIMARY KEY
("ID"));
- Use seam generate-entities
- Annotation of primary key column(ID) found in People.java should have "unique =
true" attribute:
@Id
@Column(name = "ID", unique = true, nullable = false, precision = 22,
scale = 0)
@NotNull
public BigDecimal getId() {
return this.id;
}
- Drop the PEOPLE table:
DROP TABLE "PEOPLE" CASCADE CONSTRAINTS;
- To force the schema generated from entity class, redeploy application:
seam deploy
Sorry for this mistakenly created issue. When I was writing this issue, pressed the enter
key mistakenly. Later on, decided to ask my question first in the forum:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116478
Could you please delete/close this issue? I'll create a new one, if it will be
necessary,
Thanks
unique=true attribute of primary key in generated class prevents the
schema to be regenerated
---------------------------------------------------------------------------------------------
Key: JBSEAM-1820
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1820
Project: JBoss Seam
Issue Type: Bug
Components: Tools
Affects Versions: 2.0.0.BETA1
Environment: OS: Windows Vista 6.0,x86
Database: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Java VM: Java HotSpot(TM) Server VM 1.5.0_11-b03,Sun Microsystems Inc.
Seam: jboss-seam-2.0.0.BETA1
Reporter: Ali Sadik Kumlali
Priority: Trivial
- Create PEOPLE table using following script:
CREATE TABLE PEOPLE ("ID" NUMBER NOT NULL, "SURNAME"
VARCHAR2(50 BYTE), "NAME" VARCHAR2(25 BYTE), CONSTRAINT "PEOPLE_PK"
PRIMARY KEY ("ID"));
- Generate entities:
c:\seam>seam generate-entities
- Annotation of primary key column(ID) found in People.java should have "unique =
true" attribute:
@Id
@Column(name = "ID", unique = true, nullable = false, precision = 22,
scale = 0)
@NotNull
public BigDecimal getId() {
return this.id;
}
- Drop the PEOPLE table:
DROP TABLE "PEOPLE" CASCADE CONSTRAINTS;
- To force the schema to be generated from entity classes, redeploy application:
c:\seam\examples\people_sample>ant
- Dig inside the server logs. You should see an error:
02:00:36,956 INFO [SchemaExport] Running hbm2ddl schema export
02:00:36,959 INFO [SchemaExport] exporting generated schema to database
02:00:37,215 ERROR [SchemaExport] Unsuccessful: create table PEOPLE (ID
number(22,0) not null unique, NAME varchar2(25 c
har), SURNAME varchar2(50 char), primary key (ID))
02:00:37,217 ERROR [SchemaExport] ORA-02261: such unique or primary key already
exists in the table
- Remove unique=true attribute from @Column annotation and compile/redeploy the
application. You should see table PEOPLE is created and logs are fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira