db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "svallet" <sval...@t-systems.fr>
Subject RE: Using generator directly from Java ?
Date Tue, 29 Apr 2003 16:13:43 GMT
Ok, I found an answer in the archives... wanted to do the things too fast

So I do the following :

set some properties
[...]
torqueSQLTask.initControlContext();
torqueSQLTask.execute();
torqueSQLTask.getDataModels().clear();

It works fine, but when I look at the generated SQL, the tables are
generated twice
for example :

--- begin generated file ---

# -----------------------------------------------------------------------
# ADOPTION
# -----------------------------------------------------------------------
drop table if exists ADOPTION;

CREATE TABLE ADOPTION
(
        ID_ADOPTION INTEGER NOT NULL AUTO_INCREMENT,
        ID_PARENT INTEGER,
        TABLE_PARENT VARCHAR (16),
        ID_ENFANT INTEGER NOT NULL,
        TABLE_ENFANT VARCHAR (16) NOT NULL,
    PRIMARY KEY(ID_ADOPTION)
);


# -----------------------------------------------------------------------
# ADOPTION
# -----------------------------------------------------------------------
drop table if exists ADOPTION;

CREATE TABLE ADOPTION
(
        ID_ADOPTION INTEGER NOT NULL AUTO_INCREMENT,
        ID_PARENT INTEGER,
        TABLE_PARENT VARCHAR (16),
        ID_ENFANT INTEGER NOT NULL,
        TABLE_ENFANT VARCHAR (16) NOT NULL,
    PRIMARY KEY(ID_ADOPTION)
);

--- end generated file ---

The schema is here :
&lt;?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?&gt;
&lt;!DOCTYPE database SYSTEM "database.dtd"&gt;

<database name="catgen2" defaultIdMethod="idbroker">

<table name="ADOPTION" skipSql="false">
<column name="ID_ADOPTION" type="INTEGER" required="true"
autoIncrement="true" primaryKey="true"/>
<column name="ID_PARENT" type="INTEGER" required="false"/>
<column name="TABLE_PARENT" type="VARCHAR" size="16" required="false"/>
<column name="ID_ENFANT" type="INTEGER" required="true"/>
<column name="TABLE_ENFANT" type="VARCHAR" size="16" required="true"/>
</table>

</database>

I didn't notice this when running Torque/ant from the command-line.
Is it possible that using it directly from a Java Class causes this ?
I wonder what I may have done wrong...

Thanks for any suggestions,
Simon


Mime
View raw message