Loading ...
Sorry, an error occurred while loading the content.

Root Table not set

Expand Messages
  • Mathieu GUILLON
    Hi, here s my problem : I m using Orders sample and I generate map and sql with XML-DBMS, map and sql are correctly generate but when I transfer orders.xml
    Message 1 of 3 , Sep 1, 2003
    • 0 Attachment
      Hi, here's my problem :

      I'm using Orders sample and I generate map and sql with XML-DBMS, map and
      sql are correctly generate but when I transfer orders.xml into my DBMS,
      SALESORDER table is still empty while CUSTOMER, ITEM and PART tables are
      correctly set.

      Config:
      xmldbms20alpha3 (CVS)
      MySQL 4.0.13
      JDBC driver : mysql-connector-java-3.0.8-stable-bin.jar

      Map generated:
      <?xml version='1.0' encoding="ISO8859_15_FDIS" ?>
      <!DOCTYPE XMLToDBMS >

      <XMLToDBMS Version="2.0" xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
      <Options>
      <FormatClass DefaultForTypes="BIT"
      Class="org.xmlmiddleware.conversions.formatters.BooleanFormatter"/>
      <SimpleDateFormat DefaultForTypes="TIMESTAMP" Pattern="MMM d, yyyy
      h:mm:ss a"/>
      <FormatClass DefaultForTypes="BINARY VARBINARY LONGVARBINARY"
      Class="org.xmlmiddleware.conversions.formatters.NoFormatter"/>
      <SimpleDateFormat DefaultForTypes="TIME" Pattern="h:mm:ss a"/>
      <FormatClass DefaultForTypes="LONGVARCHAR VARCHAR CHAR"
      Class="org.xmlmiddleware.conversions.formatters.CharFormatter"/>
      <DecimalFormat DefaultForTypes="BIGINT TINYINT DOUBLE REAL FLOAT
      SMALLINT INTEGER DECIMAL NUMERIC" Pattern="#,##0.###"/>
      <SimpleDateFormat DefaultForTypes="DATE" Pattern="MMM d, yyyy"/>
      </Options>
      <Databases>
      <Database Name="Orders">
      <Catalog>
      <Schema>
      <Table Name="SALESORDER">
      <Column Name="ORDERDATE" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="SALESORDERPK" DataType="INTEGER"
      Nullable="No"/>
      <Column Name="SONUMBER" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <PrimaryKey Name="SALESORDERPK" KeyGenerator="HighLow">
      <UseColumn Name="SALESORDERPK"/>
      </PrimaryKey>
      </Table>
      <Table Name="CUSTOMER">
      <Column Name="CITY" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="CUSTOMERPK" DataType="INTEGER"
      Nullable="No"/>
      <Column Name="SALESORDERFK" DataType="INTEGER"
      Nullable="No"/>
      <Column Name="CUSTNAME" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="STATE" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="STREET" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="CUSTNUMBER" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="POSTCODE" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <PrimaryKey Name="CUSTOMERPK" KeyGenerator="HighLow">
      <UseColumn Name="CUSTOMERPK"/>
      </PrimaryKey>
      <ForeignKey Name="SALESORDERFK1">
      <UseTable Database="Orders" Name="SALESORDER"/>
      <UseUniqueKey Name="SALESORDERPK"/>
      <UseColumn Name="SALESORDERFK"/>
      </ForeignKey>
      </Table>
      <Table Name="ITEM">
      <Column Name="ITEMPK" DataType="INTEGER" Nullable="No"/>
      <Column Name="QUANTITY" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="SALESORDERFK" DataType="INTEGER"
      Nullable="No"/>
      <Column Name="LINENUMBER" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <PrimaryKey Name="ITEMPK" KeyGenerator="HighLow">
      <UseColumn Name="ITEMPK"/>
      </PrimaryKey>
      <ForeignKey Name="SALESORDERFK">
      <UseTable Database="Orders" Name="SALESORDER"/>
      <UseUniqueKey Name="SALESORDERPK"/>
      <UseColumn Name="SALESORDERFK"/>
      </ForeignKey>
      </Table>
      <Table Name="PART">
      <Column Name="PARTNUMBER" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="PARTPK" DataType="INTEGER" Nullable="No"/>
      <Column Name="DESCRIPTION" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <Column Name="ITEMFK" DataType="INTEGER" Nullable="No"/>
      <Column Name="PRICE" DataType="VARCHAR" Length="255"
      Nullable="No"/>
      <PrimaryKey Name="PARTPK" KeyGenerator="HighLow">
      <UseColumn Name="PARTPK"/>
      </PrimaryKey>
      <ForeignKey Name="ITEMFK">
      <UseTable Database="Orders" Name="ITEM"/>
      <UseUniqueKey Name="ITEMPK"/>
      <UseColumn Name="ITEMFK"/>
      </ForeignKey>
      </Table>
      </Schema>
      </Catalog>
      </Database>
      </Databases>
      <Maps>
      <ClassMap>
      <ElementType Name="Part"/>
      <ToClassTable Database="Orders" Name="PART"/>
      <PropertyMap TokenList="No">
      <Attribute Name="PartNumber"/>
      <ToColumn Name="PARTNUMBER"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="Price"/>
      <ToColumn Name="PRICE"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="Description"/>
      <ToColumn Name="DESCRIPTION"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="Item"/>
      <ToClassTable Database="Orders" Name="ITEM"/>
      <PropertyMap TokenList="No">
      <Attribute Name="LineNumber"/>
      <ToColumn Name="LINENUMBER"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="Quantity"/>
      <ToColumn Name="QUANTITY"/>
      </PropertyMap>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="Part"/>
      <UseUniqueKey Name="ITEMPK"/>
      <UseForeignKey Name="ITEMFK"/>
      </RelatedClass>
      </ClassMap>
      <ClassMap>
      <ElementType Name="SalesOrder"/>
      <ToClassTable Database="Orders" Name="SALESORDER"/>
      <PropertyMap TokenList="No">
      <Attribute Name="SONumber"/>
      <ToColumn Name="SONUMBER"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="OrderDate"/>
      <ToColumn Name="ORDERDATE"/>
      </PropertyMap>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="Customer"/>
      <UseUniqueKey Name="SALESORDERPK"/>
      <UseForeignKey Name="SALESORDERFK1"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="Item"/>
      <UseUniqueKey Name="SALESORDERPK"/>
      <UseForeignKey Name="SALESORDERFK"/>
      </RelatedClass>
      </ClassMap>
      <ClassMap>
      <ElementType Name="Customer"/>
      <ToClassTable Database="Orders" Name="CUSTOMER"/>
      <PropertyMap TokenList="No">
      <Attribute Name="CustNumber"/>
      <ToColumn Name="CUSTNUMBER"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="PostCode"/>
      <ToColumn Name="POSTCODE"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="State"/>
      <ToColumn Name="STATE"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="City"/>
      <ToColumn Name="CITY"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="CustName"/>
      <ToColumn Name="CUSTNAME"/>
      </PropertyMap>
      <PropertyMap TokenList="No" ContainsXML="No">
      <ElementType Name="Street"/>
      <ToColumn Name="STREET"/>
      </PropertyMap>
      </ClassMap>
      </Maps>
      </XMLToDBMS>

      SQL generated :
      CREATE TABLE `SALESORDER` (`ORDERDATE` VARCHAR(255) NOT NULL, `SALESORDERPK`
      INTEGER NOT NULL, `SONUMBER` VARCHAR(255) NOT NULL, CONSTRAINT SALESORDERPK
      PRIMARY KEY (`SALESORDERPK`));
      CREATE TABLE `ITEM` (`ITEMPK` INTEGER NOT NULL, `QUANTITY` VARCHAR(255) NOT
      NULL, `SALESORDERFK` INTEGER NOT NULL, `LINENUMBER` VARCHAR(255) NOT NULL,
      CONSTRAINT ITEMPK PRIMARY KEY (`ITEMPK`), CONSTRAINT SALESORDERFK FOREIGN
      KEY (`SALESORDERFK`) REFERENCES `SALESORDER` (`SALESORDERPK`));
      CREATE TABLE `CUSTOMER` (`CITY` VARCHAR(255) NOT NULL, `CUSTOMERPK` INTEGER
      NOT NULL, `SALESORDERFK` INTEGER NOT NULL, `CUSTNAME` VARCHAR(255) NOT NULL,
      `STATE` VARCHAR(255) NOT NULL, `STREET` VARCHAR(255) NOT NULL, `CUSTNUMBER`
      VARCHAR(255) NOT NULL, `POSTCODE` VARCHAR(255) NOT NULL, CONSTRAINT
      CUSTOMERPK PRIMARY KEY (`CUSTOMERPK`), CONSTRAINT SALESORDERFK1 FOREIGN KEY
      (`SALESORDERFK`) REFERENCES `SALESORDER` (`SALESORDERPK`));
      CREATE TABLE `PART` (`PARTNUMBER` VARCHAR(255) NOT NULL, `PARTPK` INTEGER
      NOT NULL, `DESCRIPTION` VARCHAR(255) NOT NULL, `ITEMFK` INTEGER NOT NULL,
      `PRICE` VARCHAR(255) NOT NULL, CONSTRAINT PARTPK PRIMARY KEY (`PARTPK`),
      CONSTRAINT ITEMFK FOREIGN KEY (`ITEMFK`) REFERENCES `ITEM` (`ITEMPK`));

      Action file:
      <!DOCTYPE Actions SYSTEM "actions.dtd">
      <Actions Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
      <DefaultAction>
      <None />
      </DefaultAction>
      <Action>
      <Insert>
      <ElementType Name="SalesOrder" />
      </Insert>
      </Action>
      </Actions>

      PS: Ron, thx for previous answers, they really helped me ;)
    • mathieuguillon
      In addition, another one : When I tried to retrieve orders.xml using this action file:
      Message 2 of 3 , Sep 1, 2003
      • 0 Attachment
        In addition, another one :
        When I tried to retrieve orders.xml using this action file:
        <?xml version='1.0' ?>
        <!DOCTYPE FilterSet SYSTEM "filters.dtd" >

        <FilterSet Version="2.0"
        xmlns="http://www.xmlmiddleware.org/xmldbms/filters/v2">
        <Filters>
        <Filter>
        <RootFilter>
        <Table Name="PART" Database="Orders"/>
        <Where Condition="PARTNUMBER='123'"/>
        </RootFilter>
        </Filter>
        </Filters>
        </FilterSet>

        I got this:
        java.lang.NullPointerException
        at org.xmlmiddleware.xmldbms.DBMSToDOM.retrieveRootTableData
        (DBMSToDOM.java:346)
        at org.xmlmiddleware.xmldbms.DBMSToDOM.retrieveData
        (DBMSToDOM.java:306)
        at org.xmlmiddleware.xmldbms.DBMSToDOM.retrieveDocument
        (DBMSToDOM.java:260)
        at org.xmlmiddleware.xmldbms.DBMSToDOM.retrieveDocument
        (DBMSToDOM.java:187)
        at
        org.xmlmiddleware.xmldbms.tools.Transfer.retrieveDocumentInternal
        (Transfer.java:1064)
        at
        org.xmlmiddleware.xmldbms.tools.Transfer.retrieveXMLDocument
        (Transfer.java:638)
        at
        org.xmlmiddleware.xmldbms.tools.Transfer.dispatchRetrieveDocumentByFil
        ter(Transfer.java:934)
        at org.xmlmiddleware.xmldbms.tools.Transfer.dispatch
        (Transfer.java:504)
        at org.xmlmiddleware.xmldbms.tools.Transfer.main
        (Transfer.java:415)
      • Ronald Bourret
        I m sorry it took so long to answer this. 1) The main problem here is that your action file is invalid. The content of the Action element type is an
        Message 3 of 3 , Sep 21, 2003
        • 0 Attachment
          I'm sorry it took so long to answer this.

          1) The main problem here is that your action file is invalid. The
          content of the Action element type is an ElementType element followed by
          an action type element (None, Insert, Update, etc.). You have placed the
          ElementType element inside the Insert element, which is invalid.

          For speed reasons, XML-DBMS assumes that your map, action, and filter
          documents are valid and has unpredictable behavior if they are not. This
          shows why you should *ALWAYS* turn validation on during development. If
          you are using the Transfer tool, you can do this with the Validate
          property; see the JavaDocs for Transfer for details.

          2) Why are you using the generated map instead of the orders.map sample
          shipped with the alpha release? Generated maps *ALWAYS* have problems
          and need to be modified by hand. For example:

          a) The generated map sets all data types to VARCHAR(255), which is too
          long for some columns (e.g. STATE, CITY) and makes no sense for others
          (e.g. ORDERDATE, QUANTITY).

          b) The generated map ignores the fact that some element types/attributes
          in the DTD can be used as primary/foreign keys. For example, the
          SONumber attribute of the SalesOrder element type can be used as a
          primary key.

          c) The generated map fails to predict the correct relationship between
          tables. For example, the CUSTOMERS table should have a primary key and
          the SALESORDERS tables should have a foreign key pointing to this, but
          the generated map does this the other way around.

          The reason these errors occur is there is no way to predict correct data
          types, keys, etc. from a DTD, so the map generation software simply
          guesses.

          -- Ron

          Mathieu GUILLON wrote:
          >
          > Hi, here's my problem :
          >
          > I'm using Orders sample and I generate map and sql with XML-DBMS, map and
          > sql are correctly generate but when I transfer orders.xml into my DBMS,
          > SALESORDER table is still empty while CUSTOMER, ITEM and PART tables are
          > correctly set.
          > Action file:
          > <!DOCTYPE Actions SYSTEM "actions.dtd">
          > <Actions Version="2.0"
          > xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
          > <DefaultAction>
          > <None />
          > </DefaultAction>
          > <Action>
          > <Insert>
          > <ElementType Name="SalesOrder" />
          > </Insert>
          > </Action>
          > </Actions>
        Your message has been successfully submitted and would be delivered to recipients shortly.