db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent ROCHE <laurent_ro...@yahoo.com>
Subject Re : FK troubles Identity
Date Tue, 09 Jan 2007 10:04:57 GMT
Hi,

It is still not working properly i.e. not using ID from the data.
Here is the related extract of my bouild.xml file:
<target name="import-derby" description="Creates db and Loads data">
      <taskdef name="ddlToDatabase"
              classname="org.apache.ddlutils.task.DdlToDatabaseTask">
         <classpath refid="classpath"/>
      </taskdef>

      <ddlToDatabase schemaFile="schema-pg.xml" sortforeignkeys="false" verbosity="DEBUG"
shutdowndatabase="true" >

         <database url="jdbc:derby:pip_dev"
                 driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
                 username=""
                 password=""/>

         <createDatabase failonerror="true"/>
         <writeSchemaToDatabase/>
        <writeDataToDatabase datafile="data.xml" failonerror="true" ensureforeignkeyorder="true"
useexplicitidentityvalues ="true"/>

      </ddlToDatabase>

</target> 


What do I do wrong ?

 
Have fun,
L@u
The Computing Froggy

----- Message d'origine ----
De : Thomas Dudziak <tomdzk@gmail.com>
À : ddlutils-user@db.apache.org
Envoyé le : Mardi, 9 Janvier 2007, 6h33mn 01s
Objet : Re: FK troubles [Was: Not much info with: "Could not parse or write data file"] aka
"The Saga continues II "

On 1/8/07, Laurent ROCHE <laurent_roche@yahoo.com> wrote:


> PB2 : do not insert generated IDs for IDENTITY
> I have some tables with GENERATED BY DEFAULT AS IDENTITY for the Primary Key (most of
my tables refered by FK).
> I would then expect to get the PK from the given value and not a generated value. This
is not the case hence the rows from other tables referencing the PK on the first table will
not insert as the values are identical.

This should work fine. It is controlled via the
useExplicitIdentityValues parameter
(http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.WriteDataToDatabaseCommand.html#parameter-useexplicitidentityvalues)
whose default value is false (i.e. use the value defined by the
database (identity column) not the one in the data xml file).



Tom




__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les
messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail 

Mime
View raw message