db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Mark Donaghy" <philip.dona...@gmail.com>
Subject Re: Could not read data file data.xml
Date Wed, 10 Jan 2007 23:05:49 GMT
Hi Tom, per your request for further details...

On 1/6/07, Thomas Dudziak <tomdzk@gmail.com> wrote:
> On 1/5/07, Philip Mark Donaghy <philip.donaghy@gmail.com> wrote:
> > I get this error often and I would like to report my findings. This
> > happens when a data element contains a reference to a foreign key not
> > present in the document.
>
> This is because by default, the ensureForeignKeyOrder parameter for
> the writeDataToDatabase subtask is set to true. This will cause
> DdlUtils to defer the insertion of rows until all rows that this row
> references, are already written to the database.
> If you update DdlUtils and set the new verbosity flag to debug, then
> DdlUtils will write out which rows are held back and why.

Cool I'll check this out.

>
> > Aside from this I experienced a problem where I have a table with many
> > foreign keys none of which are required. When I dump the data using
> > ddlutils I get an element that looks like this.
> >
> > <DOCUMENTS ID="1998858" LABEL="Google Earth image of site.jpg"
> > FILE_NAME="Google Earth image of site.jpg" CUSTOMER_PROPOSAL_FK="0"
> > EQUIPMENT_FK="0" CIRCUIT_PROVIDER_FK="0" CUSTOMER_FK="2031623"
> > LOCATION_FK="0" CIRCUIT_FK="0"/>
> >
> > I havn't investigated too much but those foreign keys with a value of
> > "0" are actually null and should not appear.
>
> Could you post more info (which db, the relevant schema, etc.) ?
> DdlUtils in general does not modify the data so this might be
> something that the JDBC driver returns.
>

The database is Derby 10.1.2.1 and I'm using the Client driver. Derby
is running the NetworkServer framework on a single machine with Java
1.5.0_06

The relevant part of the schema is,

    <table name="DOCUMENTS">
      <column name="ID" primaryKey="true" required="true"
type="BIGINT" size="19" autoIncrement="false"/>
      <column name="LABEL" primaryKey="false" required="true"
type="VARCHAR" size="256" autoIncrement="false"/>
      <column name="FILE_NAME" primaryKey="false" required="false"
type="VARCHAR" size="256" autoIncrement="false"/>
      <column name="REMARKS" primaryKey="false" required="false"
type="VARCHAR" size="4096" autoIncrement="false"/>
      <column name="CUSTOMER_PROPOSAL_FK" primaryKey="false"
required="false" type="BIGINT" size="19" autoIncrement="false"/>
      <column name="EQUIPMENT_FK" primaryKey="false" required="false"
type="BIGINT" size="19" autoIncrement="false"/>
      <column name="CIRCUIT_PROVIDER_FK" primaryKey="false"
required="false" type="BIGINT" size="19" autoIncrement="false"/>
      <column name="CUSTOMER_FK" primaryKey="false" required="false"
type="BIGINT" size="19" autoIncrement="false"/>
      <column name="LOCATION_FK" primaryKey="false" required="false"
type="BIGINT" size="19" autoIncrement="false"/>
      <column name="CIRCUIT_FK" primaryKey="false" required="false"
type="BIGINT" size="19" autoIncrement="false"/>
      <foreign-key foreignTable="CIRCUIT" name="DOCUMENTS_CIRCUIT_FKC">
        <reference local="CIRCUIT_FK" foreign="ID"/>
      </foreign-key>
      <foreign-key foreignTable="CIRCUIT_PROVIDER"
name="DOCUMENTS_CIRCUIT_PROVIDER_FKC">
        <reference local="CIRCUIT_PROVIDER_FK" foreign="ID"/>
      </foreign-key>
      <foreign-key foreignTable="CUSTOMER" name="DOCUMENTS_CUSTOMER_FKC">
        <reference local="CUSTOMER_FK" foreign="ID"/>
      </foreign-key>
      <foreign-key foreignTable="CUSTOMER_PROPOSAL"
name="DOCUMENTS_CUSTOMER_PROPOSAL_FC">
        <reference local="CUSTOMER_PROPOSAL_FK" foreign="ID"/>
      </foreign-key>
      <foreign-key foreignTable="EQUIPMENT" name="DOCUMENTS_EQUIPMENT_FKC">
        <reference local="EQUIPMENT_FK" foreign="ID"/>
      </foreign-key>
      <foreign-key foreignTable="LOCATION" name="DOCUMENTS_LOCATION_FKC">
        <reference local="LOCATION_FK" foreign="ID"/>
      </foreign-key>
    </table>

I haven't checked if my framework is setting these columns to 0. I
shouldn't exclude the possiblility.

I would also like to move from Hibernate to OJB. Is there any quick
way to get started with OJB from ddltutils?

Thanks for your time,

Phil
> Tom
>


-- 
Philip Donaghy
donaghy.blogspot.com del.icio.us/donaghy/philip
Skype: philipmarkdonaghy
Office: +33 5 56 60 88 02
Mobile: +33 6 20 83 22 62

Mime
View raw message