You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Martin Kalén <ma...@curalia.se> on 2004/01/20 13:49:13 UTC
junit-target and SQL-generation
Greetings,
while doing some Oracle9i-testing of old OJB-issues in Scarab I
stumbled across a warning when running the SQL script for generation of
junit test tables.
I can't really see why things go wrong, but I have a problem following
the automagic Torque SQL-script generation so bear with me please...
The SQL errors is as follows:
"[torque-insert-sql] Failed to execute:
ALTER TABLE COLLECTION_COLLECTIBLE_CCC
ADD CONSTRAINT COLLECTION_COLLECTIBLE_CC_FK_1 FOREIGN KEY (GAT_ID)
REFERENCES COLLECTION_GATHERER (GAT_ID)
[torque-insert-sql] java.sql.SQLException:
ORA-02264: name already used by an existing constraint"
I can also see that COLLECTION_COLLECTIBLE_CC_FK_1 is defined twice.
This constraint name is used for both tables COLLECTION_COLLECTIBLE_CC
and COLLECTION_COLLECTIBLE_CCC (note the difference 2*C vs 3*C at the end).
The file target/src/sql/ojbtest-schema.sql contains:
"ALTER TABLE COLLECTION_COLLECTIBLE_CC
ADD CONSTRAINT COLLECTION_COLLECTIBLE_CC_FK_1 FOREIGN KEY (GAT_ID)
REFERENCES COLLECTION_GATHERER (GAT_ID)
;
ALTER TABLE COLLECTION_COLLECTIBLE_CCC
ADD CONSTRAINT COLLECTION_COLLECTIBLE_CC_FK_1 FOREIGN KEY (GAT_ID)
REFERENCES COLLECTION_GATHERER (GAT_ID)
;"
But if I look at the file src/test/org/apache/ojb/quick-db/OJB.script
(which I _think_ is the source of the above), I see:
"CREATE TABLE COLLECTION_COLLECTIBLE_CC(COL_ID INTEGER NOT NULL PRIMARY
KEY,NAME VARCHAR(150),GAT_ID INTEGER,EXTENT_NAME VARCHAR(150),CONSTRAINT
COLLECTION_COLLECTIBLE_CC_FK_1 FOREIGN KEY(GAT_ID) REFERENCES
COLLECTION_GATHERER(GAT_ID))
CREATE TABLE COLLECTION_COLLECTIBLE_CCC(COL_ID INTEGER NOT NULL PRIMARY
KEY,NAME VARCHAR(150),GAT_ID INTEGER,EXTENT_NAME VARCHAR(150),CONSTRAINT
COLLECTION_COLLECTIBLE_CCC_FK_1 FOREIGN KEY(GAT_ID) REFERENCES
COLLECTION_GATHERER(GAT_ID))"
In the OJB.script there is no name clash, but in ojbtest-schema.sql
there is. How come?
I'm using the Oracle9i profile with:
database = oracle
dbmsName = Oracle9i
A quick rundown of which template generates which SQL-script using what
tool would be extremely helpful. *confused* :-)
Cheers,
Martin
--
Martin Kalén
Curalia AB Web: http://www.curalia.se
Orrspelsvägen 2B Mail: info@curalia.se
SE-182 79 Stocksund Tel: +46-8-410 064 40
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org