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 : Re : FK troubles Identity
Date Wed, 10 Jan 2007 00:47:04 GMT
Hi Tom,

That's exactly what I want to do: import the data with the value in data.xml ... but that
does not work ! ! :-(

Here is an example of my problems:
I have included the table definition In PostgreSQL (classes.sql)

When running ant import-derby 
I get the following (for that table) debug messages:
============= Ant DEBUG Messages begin ==============

[ddlToDatabase] Defering insertion of row classes:class_id=4 because it is waiting for:
[ddlToDatabase]   classes:class_id=1
[ddlToDatabase] Defering insertion of row classes:class_id=7 because it is waiting for:
[ddlToDatabase]   classes:class_id=1
[ddlToDatabase] Defering insertion of row classes:class_id=3 because it is waiting for:
[ddlToDatabase]   classes:class_id=2
[ddlToDatabase] Defering insertion of row classes:class_id=5 because it is waiting for:
[ddlToDatabase]   classes:class_id=3
[ddlToDatabase] Defering insertion of row classes:class_id=8 because it is waiting for:
[ddlToDatabase]   classes:class_id=7
[ddlToDatabase] Defering insertion of row classes:class_id=9 because it is waiting for:
[ddlToDatabase]   classes:class_id=6
[ddlToDatabase] Defering insertion of row classes:class_id=10 because it is waiting for:
[ddlToDatabase]   classes:class_id=4
[ddlToDatabase] About to execute SQL: INSERT INTO classes (parent_id, class_ucd, class_nm,
class_snm, comments) VALUES (
?, ?, ?, ?, ?)
[ddlToDatabase] Inserted bean classes:class_id=1
[ddlToDatabase] Defering insertion of row classes:class_id=4 because it is waiting for:
[ddlToDatabase]   classes:class_id=1
[ddlToDatabase] Inserted deferred row classes:class_id=4
[ddlToDatabase] Defering insertion of row classes:class_id=7 because it is waiting for:
[ddlToDatabase]   classes:class_id=1
[ddlToDatabase] Inserted deferred row classes:class_id=7
[ddlToDatabase] About to execute SQL: INSERT INTO classes (parent_id, class_ucd, class_nm,
class_snm, comments) VALUES (
?, ?, ?, ?, ?)
[ddlToDatabase] Inserted bean classes:class_id=2
[ddlToDatabase] Defering insertion of row classes:class_id=3 because it is waiting for:
[ddlToDatabase]   classes:class_id=2
[ddlToDatabase] Inserted deferred row classes:class_id=3
[ddlToDatabase] About to execute SQL: INSERT INTO classes (parent_id, class_ucd, class_nm,
class_snm, comments) VALUES (
?, ?, ?, ?, ?)
[ddlToDatabase] Inserted bean classes:class_id=3
[ddlToDatabase] Defering insertion of row classes:class_id=9 because it is waiting for:
[ddlToDatabase]   classes:class_id=3
[ddlToDatabase] Inserted deferred row classes:class_id=9
[ddlToDatabase] About to execute SQL: INSERT INTO classes (parent_id, class_ucd, class_nm,
class_snm, comments) VALUES (
?, ?, ?, ?, ?)
[ddlToDatabase] Inserted bean classes:class_id=4
[ddlToDatabase] About to execute SQL: INSERT INTO classes (parent_id, class_ucd, class_nm,
class_snm, comments) VALUES (
?, ?, ?, ?, ?)
[ddlToDatabase] Inserted bean classes:class_id=5
============= Ant DEBUG Messages end ==============


and only 5 rows (out of 12) are inserted in Derby and with the wrong iDs:

ij> select * from CLASSES ;
CLASS&|PAREN&|CLASS_UCD                     |CLASS_NM
                                             |CLASS_SNM                               |COMMENTS

------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
1     |NULL  |EN                            |Engines And Propulsions
                                             |Engines                                 |NULL

2     |NULL  |HATC                          |Hatches and Ports
                                             |Hatches and Ports                       |NULL

3     |NULL  |SCHE                          |Special Cargo Handling Equipment
                                             |Cargo Handling                          |NULL

4     |NULL  |Med                           |Medical
                                             |Medical                                 |NULL

5     |4     |MedMed                        |Medecines
                                             |Medecines                               |NULL


I can not figure out what I am doing wrong.
Any ideas ?

 
Cheers,
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, 17h25mn 24s
Objet : Re: Re : FK troubles Identity

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

> 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 ?

You have to set useexplicitidentityvalues to false, otherwise DdlUtils
will use the values defined in the data XML file, not the ones
generated by the database.

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
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message