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

Filter question

Expand Messages
  • Scott Bainbridge
    Hi, I have three linked tables much like the Orders / Customer / Items ... CREATE TABLE test_customer (customer_id INTEGER primary key, customer_name
    Message 1 of 7 , Jun 22, 2005
    • 0 Attachment
      Hi,



      I have three linked tables much like the Orders / Customer / Items
      example, the exact structure is:



      --------------------------------------------

      CREATE TABLE test_customer

      (customer_id INTEGER primary key,

      customer_name VARCHAR2(40),

      street VARCHAR2(50),

      city VARCHAR2(50),

      state VARCHAR2(3),

      post_code VARCHAR2(4));



      -------------------------------------------



      CREATE TABLE test_order (

      order_id number(6) NOT NULL primary key,

      order_title varchar(50),

      customer_id number(6) NOT NULL,

      order_date DATE,

      CONSTRAINT fk_customer FOREIGN KEY (customer_id)

      REFERENCES test_customer(customer_id));



      ---------------------------------------



      create table test_item

      (item_id integer not null,

      order_id number(6) not null,

      item_description varchar(150),

      item_price number(16,4),

      item_quantity integer,

      CONSTRAINT pk_item PRIMARY KEY (item_id,order_id),

      CONSTRAINT fk_order FOREIGN KEY (order_id)

      REFERENCES test_order(order_id));





      I have done the map file and can save data to the database (Oracle) so
      that all seems to be working fine. Now I want to retrieve a single
      record from the three linked tables using the Order Id



      The filter file I am using is:



      <?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="TEST_ORDER"/>

      <Where Condition="ORDER_ID = $ORDER_ID"/>

      <RelatedTableFilter>

      <Table Name="TEST_ITEM" />

      </RelatedTableFilter>

      <RelatedTableFilter>

      <Table Name="TEST_CUSTOMER" />

      </RelatedTableFilter>

      </RootFilter>

      </Filter>

      </Filters>

      </FilterSet>



      I want to be able to read a single record from the Order table, with the
      related data from the Customer and Item tables using the Transfer
      program using the RetrieveDocumentByFilter method into a single XML
      file.



      The above filter gives me a null pointer error and all of the obvious
      combinations also give errors. Can you give me the structure for the
      Filer file??



      Thanks,











      Scott Bainbridge





      ------------------------------------------------------------------------
      The information contained in this communication is for the use of the
      individual or entity to whom it is addressed, and may contain
      information which is the subject of legal privilege and/or copyright.
      If you have received this communication in error, please notify the
      sender by return E-Mail and delete the transmission, together with any
      attachments, from your system. Thank you.
      -------------------------------------------------------------------------



      [Non-text portions of this message have been removed]
    • Ronald Bourret
      There are two problems with your filter document: 1) The document is not valid according to filters.dtd. The class that compiles filter documents assumes that
      Message 2 of 7 , Jun 22, 2005
      • 0 Attachment
        There are two problems with your filter document:

        1) The document is not valid according to filters.dtd. The class that
        compiles filter documents assumes that they are valid and has
        unpredictable results if they are not. I assume this is where your
        errors are occurring.

        At a minimum, I noticed two problems. First, the RelatedTableFilter
        element should be a child of TableFilter, not RootFilter. Second, the
        RelatedTableFilter element must have at least one Where child element.

        The Transfer tool allows you to optionally perform validation on map,
        filter, and action documents, using the Validate property. You should
        always turn validation on during development, even if you choose not to
        do validation at run time.

        2) Because you do not have any Where children in your RelatedTableFilter
        elements, I assume all you really want to do is reconstruct entire
        orders, rather than partial orders. (For example, you want to include
        all items, rather than items whose price is greater than 100.) To do
        this, you do not need any RelatedTableFilter elements -- the map
        document provides this information already.

        To understand what is going on, you can think of transferring data from
        the database to XML as a two-part query. The map document provides the
        hierarchical structure of the query -- that is, the order in which
        tables are to be joined -- and the filter document filters the data from
        a particular table.

        Therefore, the filter document you need is:

        <?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="TEST_ORDER"/>
        <Where Condition="ORDER_ID = $ORDER_ID"/>
        </RootFilter>
        </Filter>
        </Filters>
        </FilterSet>

        This will retrieve all the data for the specified order. The map
        document provides the information XML-DBMS needs to join the test_order
        table to the test_customer and test_item tables.

        If, on the other hand, you wanted to retrieve an order and only those
        items with a price greater than 100, you would need a RelatedTableFilter
        element:

        <?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="TEST_ORDER"/>
        <Where Condition="ORDER_ID = $ORDER_ID"/>
        </RootFilter>
        <!-- This TableFilter element provides information
        about how to filter data when joining the TEST_ORDER
        table to other tables - in this case, the TEST_ITEM
        table. -->
        <TableFilter>
        <Table Name="TEST_ORDER" />
        <RelatedTableFilter>
        <Table Name="TEST_ITEM" />
        <Where Condition="item_price > 100.0000" />
        </RelatedTableFilter>
        </TableFilter>
        </Filter>
        </Filters>
        </FilterSet>

        One thing to be careful of is that the case of the table and column
        names in your map and filter documents exactly match the case in which
        these names are stored in the database. This is because XML-DBMS treats
        all names as quoted identifiers. I mention this because your CREATE
        TABLE statements use a different case than your filter document.

        -- Ron

        Scott Bainbridge wrote:

        > Hi,
        >
        >
        >
        > I have three linked tables much like the Orders / Customer / Items
        > example, the exact structure is:
        >
        >
        >
        > --------------------------------------------
        >
        > CREATE TABLE test_customer
        >
        > (customer_id INTEGER primary key,
        >
        > customer_name VARCHAR2(40),
        >
        > street VARCHAR2(50),
        >
        > city VARCHAR2(50),
        >
        > state VARCHAR2(3),
        >
        > post_code VARCHAR2(4));
        >
        >
        >
        > -------------------------------------------
        >
        >
        >
        > CREATE TABLE test_order (
        >
        > order_id number(6) NOT NULL primary key,
        >
        > order_title varchar(50),
        >
        > customer_id number(6) NOT NULL,
        >
        > order_date DATE,
        >
        > CONSTRAINT fk_customer FOREIGN KEY (customer_id)
        >
        > REFERENCES test_customer(customer_id));
        >
        >
        >
        > ---------------------------------------
        >
        >
        >
        > create table test_item
        >
        > (item_id integer not null,
        >
        > order_id number(6) not null,
        >
        > item_description varchar(150),
        >
        > item_price number(16,4),
        >
        > item_quantity integer,
        >
        > CONSTRAINT pk_item PRIMARY KEY (item_id,order_id),
        >
        > CONSTRAINT fk_order FOREIGN KEY (order_id)
        >
        > REFERENCES test_order(order_id));
        >
        >
        >
        >
        >
        > I have done the map file and can save data to the database (Oracle) so
        > that all seems to be working fine. Now I want to retrieve a single
        > record from the three linked tables using the Order Id
        >
        >
        >
        > The filter file I am using is:
        >
        >
        >
        > <?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="TEST_ORDER"/>
        >
        > <Where Condition="ORDER_ID = $ORDER_ID"/>
        >
        > <RelatedTableFilter>
        >
        > <Table Name="TEST_ITEM" />
        >
        > </RelatedTableFilter>
        >
        > <RelatedTableFilter>
        >
        > <Table Name="TEST_CUSTOMER" />
        >
        > </RelatedTableFilter>
        >
        > </RootFilter>
        >
        > </Filter>
        >
        > </Filters>
        >
        > </FilterSet>
        >
        >
        >
        > I want to be able to read a single record from the Order table, with the
        > related data from the Customer and Item tables using the Transfer
        > program using the RetrieveDocumentByFilter method into a single XML
        > file.
        >
        >
        >
        > The above filter gives me a null pointer error and all of the obvious
        > combinations also give errors. Can you give me the structure for the
        > Filer file??
        >
        >
        >
        > Thanks,
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > Scott Bainbridge
        >
        >
        >
        >
        >
        > ------------------------------------------------------------------------
        > The information contained in this communication is for the use of the
        > individual or entity to whom it is addressed, and may contain
        > information which is the subject of legal privilege and/or copyright.
        > If you have received this communication in error, please notify the
        > sender by return E-Mail and delete the transmission, together with any
        > attachments, from your system. Thank you.
        > -------------------------------------------------------------------------
        >
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >
        > To post a message, send it to: xml-dbms@yahoogroups.com
        > To unsubscribe, send a blank message to: xml-dbms-unsubscribe@yahoogroups.com
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • sctt_bainbridge
        Thanks, I tired your filter, which in fact was what I started with before I got lost on related tables, etc and it, after a fair pause, gives the following
        Message 3 of 7 , Jun 23, 2005
        • 0 Attachment
          Thanks,

          I tired your filter, which in fact was what I started with before I
          got lost on related tables, etc and it, after a fair pause, gives
          the following error:

          java.lang.StackOverflowError
          at java.lang.ClassCastException.<init>
          (ClassCastException.java:39)
          at
          org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameter
          (Parameters.java:138)
          at
          org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameters
          (Parameters.java:89)
          at
          org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.makeSelect
          (DataHandlerBase.java:335)
          at
          org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.select
          (DataHandlerBase.java:289)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:582)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
          (DBMSToDOM.java:405)
          at
          org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
          (DBMSToDOM.java:583)
          at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
          (DBMSToDOM.java:523)

          I am going to do a simpler example and see how I go with that, what
          I may have wrong is the map file which works for inserts. What I may
          have wrong are the relationships as items sits underneath orders but
          customers sits to the side if you know what I mean. Am I on the
          right path???

          Thanks,



          Scott.


          --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
          wrote:
          > There are two problems with your filter document:
          >
          > 1) The document is not valid according to filters.dtd. The class
          that
          > compiles filter documents assumes that they are valid and has
          > unpredictable results if they are not. I assume this is where your
          > errors are occurring.
          >
          > At a minimum, I noticed two problems. First, the
          RelatedTableFilter
          > element should be a child of TableFilter, not RootFilter. Second,
          the
          > RelatedTableFilter element must have at least one Where child
          element.
          >
          > The Transfer tool allows you to optionally perform validation on
          map,
          > filter, and action documents, using the Validate property. You
          should
          > always turn validation on during development, even if you choose
          not to
          > do validation at run time.
          >
          > 2) Because you do not have any Where children in your
          RelatedTableFilter
          > elements, I assume all you really want to do is reconstruct entire
          > orders, rather than partial orders. (For example, you want to
          include
          > all items, rather than items whose price is greater than 100.) To
          do
          > this, you do not need any RelatedTableFilter elements -- the map
          > document provides this information already.
          >
          > To understand what is going on, you can think of transferring data
          from
          > the database to XML as a two-part query. The map document provides
          the
          > hierarchical structure of the query -- that is, the order in which
          > tables are to be joined -- and the filter document filters the
          data from
          > a particular table.
          >
          > Therefore, the filter document you need is:
          >
          > <?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="TEST_ORDER"/>
          > <Where Condition="ORDER_ID = $ORDER_ID"/>
          > </RootFilter>
          > </Filter>
          > </Filters>
          > </FilterSet>
          >
          > This will retrieve all the data for the specified order. The map
          > document provides the information XML-DBMS needs to join the
          test_order
          > table to the test_customer and test_item tables.
          >
          > If, on the other hand, you wanted to retrieve an order and only
          those
          > items with a price greater than 100, you would need a
          RelatedTableFilter
          > element:
          >
          > <?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="TEST_ORDER"/>
          > <Where Condition="ORDER_ID = $ORDER_ID"/>
          > </RootFilter>
          > <!-- This TableFilter element provides information
          > about how to filter data when joining the
          TEST_ORDER
          > table to other tables - in this case, the
          TEST_ITEM
          > table. -->
          > <TableFilter>
          > <Table Name="TEST_ORDER" />
          > <RelatedTableFilter>
          > <Table Name="TEST_ITEM" />
          > <Where Condition="item_price > 100.0000" />
          > </RelatedTableFilter>
          > </TableFilter>
          > </Filter>
          > </Filters>
          > </FilterSet>
          >
          > One thing to be careful of is that the case of the table and
          column
          > names in your map and filter documents exactly match the case in
          which
          > these names are stored in the database. This is because XML-DBMS
          treats
          > all names as quoted identifiers. I mention this because your
          CREATE
          > TABLE statements use a different case than your filter document.
          >
          > -- Ron
          >
          > Scott Bainbridge wrote:
          >
          > > Hi,
          > >
          > >
          > >
          > > I have three linked tables much like the Orders / Customer /
          Items
          > > example, the exact structure is:
          > >
          > >
          > >
          > > --------------------------------------------
          > >
          > > CREATE TABLE test_customer
          > >
          > > (customer_id INTEGER primary key,
          > >
          > > customer_name VARCHAR2(40),
          > >
          > > street VARCHAR2(50),
          > >
          > > city VARCHAR2(50),
          > >
          > > state VARCHAR2(3),
          > >
          > > post_code VARCHAR2(4));
          > >
          > >
          > >
          > > -------------------------------------------
          > >
          > >
          > >
          > > CREATE TABLE test_order (
          > >
          > > order_id number(6) NOT NULL primary key,
          > >
          > > order_title varchar(50),
          > >
          > > customer_id number(6) NOT NULL,
          > >
          > > order_date DATE,
          > >
          > > CONSTRAINT fk_customer FOREIGN KEY (customer_id)
          > >
          > > REFERENCES test_customer(customer_id));
          > >
          > >
          > >
          > > ---------------------------------------
          > >
          > >
          > >
          > > create table test_item
          > >
          > > (item_id integer not null,
          > >
          > > order_id number(6) not null,
          > >
          > > item_description varchar(150),
          > >
          > > item_price number(16,4),
          > >
          > > item_quantity integer,
          > >
          > > CONSTRAINT pk_item PRIMARY KEY (item_id,order_id),
          > >
          > > CONSTRAINT fk_order FOREIGN KEY (order_id)
          > >
          > > REFERENCES test_order(order_id));
          > >
          > >
          > >
          > >
          > >
          > > I have done the map file and can save data to the database
          (Oracle) so
          > > that all seems to be working fine. Now I want to retrieve a
          single
          > > record from the three linked tables using the Order Id
          > >
          > >
          > >
          > > The filter file I am using is:
          > >
          > >
          > >
          > > <?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="TEST_ORDER"/>
          > >
          > > <Where Condition="ORDER_ID = $ORDER_ID"/>
          > >
          > > <RelatedTableFilter>
          > >
          > > <Table Name="TEST_ITEM" />
          > >
          > > </RelatedTableFilter>
          > >
          > > <RelatedTableFilter>
          > >
          > > <Table Name="TEST_CUSTOMER" />
          > >
          > > </RelatedTableFilter>
          > >
          > > </RootFilter>
          > >
          > > </Filter>
          > >
          > > </Filters>
          > >
          > > </FilterSet>
          > >
          > >
          > >
          > > I want to be able to read a single record from the Order table,
          with the
          > > related data from the Customer and Item tables using the Transfer
          > > program using the RetrieveDocumentByFilter method into a single
          XML
          > > file.
          > >
          > >
          > >
          > > The above filter gives me a null pointer error and all of the
          obvious
          > > combinations also give errors. Can you give me the structure for
          the
          > > Filer file??
          > >
          > >
          > >
          > > Thanks,
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > > Scott Bainbridge
          > >
          > >
          > >
          > >
          > >
          > > -----------------------------------------------------------------
          -------
          > > The information contained in this communication is for the use
          of the
          > > individual or entity to whom it is addressed, and may
          contain
          > > information which is the subject of legal privilege and/or
          copyright.
          > > If you have received this communication in error, please
          notify the
          > > sender by return E-Mail and delete the transmission, together
          with any
          > > attachments, from your system. Thank you.
          > > -----------------------------------------------------------------
          --------
          > >
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          > >
          > >
          > > To post a message, send it to: xml-dbms@yahoogroups.com
          > > To unsubscribe, send a blank message to: xml-dbms-
          unsubscribe@yahoogroups.com
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
        • Ronald Bourret
          Could you post your map to the list or send it to me privately? The class cast exception while setting parameters makes me think that there is a problem with
          Message 4 of 7 , Jun 24, 2005
          • 0 Attachment
            Could you post your map to the list or send it to me privately? The
            class cast exception while setting parameters makes me think that there
            is a problem with data types -- for example, the customer ID is integer
            in one table and number(6) in another -- but I am also confused by the
            number of calls to processRelatedTables, which seems to indicate a much
            deeper level of nesting than I was expecting.

            (If I recall correctly, processRelatedTables will appear in an error
            stack as many times as the elements are nested minus one. In the case of
            your tables, I would expect only one call -- either to process the item
            table or to process the customer table, each of which is nested beneath
            the order table.)

            The table hierarchy is not a problem, with items and customers both
            under orders as "siblings". ("To the side", as you say.)

            -- Ron

            sctt_bainbridge wrote:
            > Thanks,
            >
            > I tired your filter, which in fact was what I started with before I
            > got lost on related tables, etc and it, after a fair pause, gives
            > the following error:
            >
            > java.lang.StackOverflowError
            > at java.lang.ClassCastException.<init>
            > (ClassCastException.java:39)
            > at
            > org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameter
            > (Parameters.java:138)
            > at
            > org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameters
            > (Parameters.java:89)
            > at
            > org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.makeSelect
            > (DataHandlerBase.java:335)
            > at
            > org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.select
            > (DataHandlerBase.java:289)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:582)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
            > (DBMSToDOM.java:405)
            > at
            > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
            > (DBMSToDOM.java:583)
            > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
            > (DBMSToDOM.java:523)
            >
            > I am going to do a simpler example and see how I go with that, what
            > I may have wrong is the map file which works for inserts. What I may
            > have wrong are the relationships as items sits underneath orders but
            > customers sits to the side if you know what I mean. Am I on the
            > right path???
            >
            > Thanks,
            >
            >
            >
            > Scott.
          • sctt_bainbridge
            Hi, the map is:
            Message 5 of 7 , Jun 24, 2005
            • 0 Attachment
              Hi,

              the map is:

              <?xml version='1.0' ?>

              <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >

              <XMLToDBMS Version="2.0"
              xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
              <Options>
              <SimpleDateFormat Pattern="yyyy-mm-dd"
              DefaultForTypes="DATE" />
              </Options>
              <Databases>
              <Database>
              <Catalog>
              <Schema>
              <Table Name="TEST_CUSTOMER">
              <Column Name="CUSTOMER_ID" DataType="INTEGER"
              Length="6" Nullable="No"/>
              <Column Name="CUSTOMER_NAME" DataType="VARCHAR"
              Length="50" Nullable="Yes"/>
              <Column Name="STREET" DataType="VARCHAR"
              Length="150" Nullable="Yes"/>
              <Column Name="CITY" DataType="VARCHAR"
              Length="50" Nullable="Yes"/>
              <Column Name="STATE" DataType="VARCHAR"
              Length="50" Nullable="Yes"/>
              <Column Name="POST_CODE" DataType="VARCHAR"
              Length="4" Nullable="Yes"/>
              <PrimaryKey>
              <UseColumn Name="CUSTOMER_ID"
              KeyGenerator="Database"/>
              </PrimaryKey>
              </Table>
              <Table Name="TEST_ORDER">
              <Column Name="ORDER_ID" DataType="INTEGER"
              Length="6" Nullable="No"/>
              <Column Name="ORDER_TITLE" DataType="VARCHAR"
              Length="50" Nullable="Yes"/>
              <Column Name="CUSTOMER_ID" DataType="INTEGER"
              Length="6" Nullable="No"/>
              <Column Name="ORDER_DATE" DataType="DATE"
              Nullable="No"/>
              <PrimaryKey>
              <UseColumn Name="ORDER_ID"/>
              </PrimaryKey>
              <ForeignKey Name="FK_CUSTOMER">
              <UseTable Name="TEST_CUSTOMER" />
              <UseUniqueKey Name="PrimaryKey" />
              <UseColumn Name="CUSTOMER_ID"/>
              </ForeignKey>
              </Table>
              <Table Name="TEST_ITEM">
              <Column Name="ITEM_ID" DataType="INTEGER"
              Nullable="No"/>
              <Column Name="ORDER_ID" DataType="INTEGER"
              Nullable="No"/>
              <Column Name="ITEM_DESCRIPTION"
              DataType="VARCHAR" Length="150" Nullable="Yes"/>
              <Column Name="ITEM_PRICE" DataType="DOUBLE"
              Nullable="No"/>
              <Column Name="ITEM_QUANTITY" DataType="INTEGER"
              Length="6" Nullable="No"/>
              <PrimaryKey>
              <UseColumn Name="ORDER_ID"/>
              <UseColumn Name="ITEM_ID"
              KeyGenerator="Database"/>
              </PrimaryKey>
              <ForeignKey Name="FK_ORDER">
              <UseTable Name="TEST_ORDER" />
              <UseUniqueKey Name="PrimaryKey" />
              <UseColumn Name="ORDER_ID"/>
              </ForeignKey>
              </Table>
              </Schema>
              </Catalog>
              </Database>
              </Databases>
              <Maps>
              <ClassMap>
              <ElementType Name="customer"/>
              <ToClassTable Name="TEST_CUSTOMER"/>
              <PropertyMap>
              <ElementType Name="customerid"/>
              <ToColumn Name="CUSTOMER_ID"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="custname"/>
              <ToColumn Name="CUSTOMER_NAME"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="street"/>
              <ToColumn Name="STREET"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="city"/>
              <ToColumn Name="CITY"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="state"/>
              <ToColumn Name="STATE"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="postcode"/>
              <ToColumn Name="POST_CODE"/>
              </PropertyMap>
              </ClassMap>
              <ClassMap>
              <ElementType Name="order"/>
              <ToClassTable Name="TEST_ORDER"/>
              <PropertyMap>
              <ElementType Name="id"/>
              <ToColumn Name="ORDER_ID"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="title"/>
              <ToColumn Name="ORDER_TITLE"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="customerid"/>
              <ToColumn Name="CUSTOMER_ID"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="orderdate"/>
              <ToColumn Name="ORDER_DATE"/>
              </PropertyMap>
              <RelatedClass KeyInParentTable="Foreign">
              <ElementType Name="customer"/>
              <UseUniqueKey Name="PrimaryKey"/>
              <UseForeignKey Name="FK_CUSTOMER"/>
              </RelatedClass>
              <RelatedClass KeyInParentTable="Unique">
              <ElementType Name="item"/>
              <UseUniqueKey Name="PrimaryKey"/>
              <UseForeignKey Name="FK_ORDER"/>
              <OrderColumn Name="ITEM_ID" Direction="Ascending" />
              </RelatedClass>
              </ClassMap>
              <ClassMap>
              <ElementType Name="item"/>
              <ToClassTable Name="TEST_ITEM"/>
              <PropertyMap>
              <ElementType Name="itemid"/>
              <ToColumn Name="ITEM_ID"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="id"/>
              <ToColumn Name="ORDER_ID"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="description"/>
              <ToColumn Name="ITEM_DESCRIPTION"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="price"/>
              <ToColumn Name="ITEM_PRICE"/>
              </PropertyMap>
              <PropertyMap>
              <ElementType Name="quantity"/>
              <ToColumn Name="ITEM_QUANTITY"/>
              </PropertyMap>
              <RelatedClass KeyInParentTable="Foreign">
              <ElementType Name="order"/>
              <UseUniqueKey Name="PrimaryKey"/>
              <UseForeignKey Name="FK_ORDER"/>
              </RelatedClass>
              </ClassMap>
              </Maps>
              </XMLToDBMS>

              I still think this is somehow bound up in the relationship between
              the tables and the keys used to relate them...

              Again thanks for any help.


              Scott.

              --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
              wrote:
              > Could you post your map to the list or send it to me privately?
              The
              > class cast exception while setting parameters makes me think that
              there
              > is a problem with data types -- for example, the customer ID is
              integer
              > in one table and number(6) in another -- but I am also confused by
              the
              > number of calls to processRelatedTables, which seems to indicate a
              much
              > deeper level of nesting than I was expecting.
              >
              > (If I recall correctly, processRelatedTables will appear in an
              error
              > stack as many times as the elements are nested minus one. In the
              case of
              > your tables, I would expect only one call -- either to process the
              item
              > table or to process the customer table, each of which is nested
              beneath
              > the order table.)
              >
              > The table hierarchy is not a problem, with items and customers
              both
              > under orders as "siblings". ("To the side", as you say.)
              >
              > -- Ron
              >
              > sctt_bainbridge wrote:
              > > Thanks,
              > >
              > > I tired your filter, which in fact was what I started with
              before I
              > > got lost on related tables, etc and it, after a fair pause,
              gives
              > > the following error:
              > >
              > > java.lang.StackOverflowError
              > > at java.lang.ClassCastException.<init>
              > > (ClassCastException.java:39)
              > > at
              > > org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameter
              > > (Parameters.java:138)
              > > at
              > > org.xmlmiddleware.xmldbms.datahandlers.Parameters.setParameters
              > > (Parameters.java:89)
              > > at
              > > org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.makeSelect
              > > (DataHandlerBase.java:335)
              > > at
              > > org.xmlmiddleware.xmldbms.datahandlers.DataHandlerBase.select
              > > (DataHandlerBase.java:289)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:582)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processClassResultSet
              > > (DBMSToDOM.java:405)
              > > at
              > > org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedClassTable
              > > (DBMSToDOM.java:583)
              > > at org.xmlmiddleware.xmldbms.DBMSToDOM.processRelatedTables
              > > (DBMSToDOM.java:523)
              > >
              > > I am going to do a simpler example and see how I go with that,
              what
              > > I may have wrong is the map file which works for inserts. What I
              may
              > > have wrong are the relationships as items sits underneath orders
              but
              > > customers sits to the side if you know what I mean. Am I on the
              > > right path???
              > >
              > > Thanks,
              > >
              > >
              > >
              > > Scott.
            • Ronald Bourret
              Cool! I d never thought about this, but you ve managed to put XML-DBMS into an infinite loop, which would explain the stack overflow error. To solve this,
              Message 6 of 7 , Jun 24, 2005
              • 0 Attachment
                Cool! I'd never thought about this, but you've managed to put XML-DBMS
                into an infinite loop, which would explain the stack overflow error. To
                solve this, remove the RelatedClass element (and its children) from the
                ClassMap for item (TEST_ITEM table).

                Basically, RelatedClass says to include another "class" element inside
                the current "class" element. You only need to add a RelatedClass element
                to the ClassMap of the parent element type -- in your case, the order
                element type.

                So while your ClassMap for the order element type correctly says that it
                should include one or more item elements, your ClassMap for the item
                element type incorrectly says that it should include an order element.
                In other words, you're trying to construct the following XML document:

                <order>
                ...
                <item>
                ...
                <order>
                ...
                <item>
                ...

                Because XML-DBMS continually joins the orders table to the items table
                on the order ID and vice versa, this process never ends.

                One other comment is that you probably don't want a PropertyMap for the
                ORDER_ID column in the ClassMap for item. This will repeat the order ID
                in each item element, which is redundant, since the order ID is already
                a child element of the order element.

                -- Ron

                sctt_bainbridge wrote:
                > Hi,
                >
                > the map is:
                >
                > <?xml version='1.0' ?>
                >
                > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >
                >
                > <XMLToDBMS Version="2.0"
                > xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
                > <Options>
                > <SimpleDateFormat Pattern="yyyy-mm-dd"
                > DefaultForTypes="DATE" />
                > </Options>
                > <Databases>
                > <Database>
                > <Catalog>
                > <Schema>
                > <Table Name="TEST_CUSTOMER">
                > <Column Name="CUSTOMER_ID" DataType="INTEGER"
                > Length="6" Nullable="No"/>
                > <Column Name="CUSTOMER_NAME" DataType="VARCHAR"
                > Length="50" Nullable="Yes"/>
                > <Column Name="STREET" DataType="VARCHAR"
                > Length="150" Nullable="Yes"/>
                > <Column Name="CITY" DataType="VARCHAR"
                > Length="50" Nullable="Yes"/>
                > <Column Name="STATE" DataType="VARCHAR"
                > Length="50" Nullable="Yes"/>
                > <Column Name="POST_CODE" DataType="VARCHAR"
                > Length="4" Nullable="Yes"/>
                > <PrimaryKey>
                > <UseColumn Name="CUSTOMER_ID"
                > KeyGenerator="Database"/>
                > </PrimaryKey>
                > </Table>
                > <Table Name="TEST_ORDER">
                > <Column Name="ORDER_ID" DataType="INTEGER"
                > Length="6" Nullable="No"/>
                > <Column Name="ORDER_TITLE" DataType="VARCHAR"
                > Length="50" Nullable="Yes"/>
                > <Column Name="CUSTOMER_ID" DataType="INTEGER"
                > Length="6" Nullable="No"/>
                > <Column Name="ORDER_DATE" DataType="DATE"
                > Nullable="No"/>
                > <PrimaryKey>
                > <UseColumn Name="ORDER_ID"/>
                > </PrimaryKey>
                > <ForeignKey Name="FK_CUSTOMER">
                > <UseTable Name="TEST_CUSTOMER" />
                > <UseUniqueKey Name="PrimaryKey" />
                > <UseColumn Name="CUSTOMER_ID"/>
                > </ForeignKey>
                > </Table>
                > <Table Name="TEST_ITEM">
                > <Column Name="ITEM_ID" DataType="INTEGER"
                > Nullable="No"/>
                > <Column Name="ORDER_ID" DataType="INTEGER"
                > Nullable="No"/>
                > <Column Name="ITEM_DESCRIPTION"
                > DataType="VARCHAR" Length="150" Nullable="Yes"/>
                > <Column Name="ITEM_PRICE" DataType="DOUBLE"
                > Nullable="No"/>
                > <Column Name="ITEM_QUANTITY" DataType="INTEGER"
                > Length="6" Nullable="No"/>
                > <PrimaryKey>
                > <UseColumn Name="ORDER_ID"/>
                > <UseColumn Name="ITEM_ID"
                > KeyGenerator="Database"/>
                > </PrimaryKey>
                > <ForeignKey Name="FK_ORDER">
                > <UseTable Name="TEST_ORDER" />
                > <UseUniqueKey Name="PrimaryKey" />
                > <UseColumn Name="ORDER_ID"/>
                > </ForeignKey>
                > </Table>
                > </Schema>
                > </Catalog>
                > </Database>
                > </Databases>
                > <Maps>
                > <ClassMap>
                > <ElementType Name="customer"/>
                > <ToClassTable Name="TEST_CUSTOMER"/>
                > <PropertyMap>
                > <ElementType Name="customerid"/>
                > <ToColumn Name="CUSTOMER_ID"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="custname"/>
                > <ToColumn Name="CUSTOMER_NAME"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="street"/>
                > <ToColumn Name="STREET"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="city"/>
                > <ToColumn Name="CITY"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="state"/>
                > <ToColumn Name="STATE"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="postcode"/>
                > <ToColumn Name="POST_CODE"/>
                > </PropertyMap>
                > </ClassMap>
                > <ClassMap>
                > <ElementType Name="order"/>
                > <ToClassTable Name="TEST_ORDER"/>
                > <PropertyMap>
                > <ElementType Name="id"/>
                > <ToColumn Name="ORDER_ID"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="title"/>
                > <ToColumn Name="ORDER_TITLE"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="customerid"/>
                > <ToColumn Name="CUSTOMER_ID"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="orderdate"/>
                > <ToColumn Name="ORDER_DATE"/>
                > </PropertyMap>
                > <RelatedClass KeyInParentTable="Foreign">
                > <ElementType Name="customer"/>
                > <UseUniqueKey Name="PrimaryKey"/>
                > <UseForeignKey Name="FK_CUSTOMER"/>
                > </RelatedClass>
                > <RelatedClass KeyInParentTable="Unique">
                > <ElementType Name="item"/>
                > <UseUniqueKey Name="PrimaryKey"/>
                > <UseForeignKey Name="FK_ORDER"/>
                > <OrderColumn Name="ITEM_ID" Direction="Ascending" />
                > </RelatedClass>
                > </ClassMap>
                > <ClassMap>
                > <ElementType Name="item"/>
                > <ToClassTable Name="TEST_ITEM"/>
                > <PropertyMap>
                > <ElementType Name="itemid"/>
                > <ToColumn Name="ITEM_ID"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="id"/>
                > <ToColumn Name="ORDER_ID"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="description"/>
                > <ToColumn Name="ITEM_DESCRIPTION"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="price"/>
                > <ToColumn Name="ITEM_PRICE"/>
                > </PropertyMap>
                > <PropertyMap>
                > <ElementType Name="quantity"/>
                > <ToColumn Name="ITEM_QUANTITY"/>
                > </PropertyMap>
                > <RelatedClass KeyInParentTable="Foreign">
                > <ElementType Name="order"/>
                > <UseUniqueKey Name="PrimaryKey"/>
                > <UseForeignKey Name="FK_ORDER"/>
                > </RelatedClass>
                > </ClassMap>
                > </Maps>
                > </XMLToDBMS>
                >
                > I still think this is somehow bound up in the relationship between
                > the tables and the keys used to relate them...
                >
                > Again thanks for any help.
                >
                >
                > Scott.
              • sctt_bainbridge
                Thanks!! That seems to have fixed it and now it all works - again many many thanks for helping me. Cheers, Scott. ... DBMS ... error. To ... from the ...
                Message 7 of 7 , Jun 26, 2005
                • 0 Attachment
                  Thanks!! That seems to have fixed it and now it all works - again
                  many many thanks for helping me.

                  Cheers,



                  Scott.

                  --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
                  wrote:
                  > Cool! I'd never thought about this, but you've managed to put XML-
                  DBMS
                  > into an infinite loop, which would explain the stack overflow
                  error. To
                  > solve this, remove the RelatedClass element (and its children)
                  from the
                  > ClassMap for item (TEST_ITEM table).
                  >
                  > Basically, RelatedClass says to include another "class" element
                  inside
                  > the current "class" element. You only need to add a RelatedClass
                  element
                  > to the ClassMap of the parent element type -- in your case, the
                  order
                  > element type.
                  >
                  > So while your ClassMap for the order element type correctly says
                  that it
                  > should include one or more item elements, your ClassMap for the
                  item
                  > element type incorrectly says that it should include an order
                  element.
                  > In other words, you're trying to construct the following XML
                  document:
                  >
                  > <order>
                  > ...
                  > <item>
                  > ...
                  > <order>
                  > ...
                  > <item>
                  > ...
                  >
                  > Because XML-DBMS continually joins the orders table to the items
                  table
                  > on the order ID and vice versa, this process never ends.
                  >
                  > One other comment is that you probably don't want a PropertyMap
                  for the
                  > ORDER_ID column in the ClassMap for item. This will repeat the
                  order ID
                  > in each item element, which is redundant, since the order ID is
                  already
                  > a child element of the order element.
                  >
                  > -- Ron
                  >
                  > sctt_bainbridge wrote:
                  > > Hi,
                  > >
                  > > the map is:
                  > >
                  > > <?xml version='1.0' ?>
                  > >
                  > > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >
                  > >
                  > > <XMLToDBMS Version="2.0"
                  > > xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
                  > > <Options>
                  > > <SimpleDateFormat Pattern="yyyy-mm-dd"
                  > > DefaultForTypes="DATE" />
                  > > </Options>
                  > > <Databases>
                  > > <Database>
                  > > <Catalog>
                  > > <Schema>
                  > > <Table Name="TEST_CUSTOMER">
                  > > <Column Name="CUSTOMER_ID" DataType="INTEGER"
                  > > Length="6" Nullable="No"/>
                  > > <Column Name="CUSTOMER_NAME"
                  DataType="VARCHAR"
                  > > Length="50" Nullable="Yes"/>
                  > > <Column Name="STREET" DataType="VARCHAR"
                  > > Length="150" Nullable="Yes"/>
                  > > <Column Name="CITY" DataType="VARCHAR"
                  > > Length="50" Nullable="Yes"/>
                  > > <Column Name="STATE" DataType="VARCHAR"
                  > > Length="50" Nullable="Yes"/>
                  > > <Column Name="POST_CODE" DataType="VARCHAR"
                  > > Length="4" Nullable="Yes"/>
                  > > <PrimaryKey>
                  > > <UseColumn Name="CUSTOMER_ID"
                  > > KeyGenerator="Database"/>
                  > > </PrimaryKey>
                  > > </Table>
                  > > <Table Name="TEST_ORDER">
                  > > <Column Name="ORDER_ID" DataType="INTEGER"
                  > > Length="6" Nullable="No"/>
                  > > <Column Name="ORDER_TITLE" DataType="VARCHAR"
                  > > Length="50" Nullable="Yes"/>
                  > > <Column Name="CUSTOMER_ID" DataType="INTEGER"
                  > > Length="6" Nullable="No"/>
                  > > <Column Name="ORDER_DATE" DataType="DATE"
                  > > Nullable="No"/>
                  > > <PrimaryKey>
                  > > <UseColumn Name="ORDER_ID"/>
                  > > </PrimaryKey>
                  > > <ForeignKey Name="FK_CUSTOMER">
                  > > <UseTable Name="TEST_CUSTOMER" />
                  > > <UseUniqueKey Name="PrimaryKey" />
                  > > <UseColumn Name="CUSTOMER_ID"/>
                  > > </ForeignKey>
                  > > </Table>
                  > > <Table Name="TEST_ITEM">
                  > > <Column Name="ITEM_ID" DataType="INTEGER"
                  > > Nullable="No"/>
                  > > <Column Name="ORDER_ID" DataType="INTEGER"
                  > > Nullable="No"/>
                  > > <Column Name="ITEM_DESCRIPTION"
                  > > DataType="VARCHAR" Length="150" Nullable="Yes"/>
                  > > <Column Name="ITEM_PRICE" DataType="DOUBLE"
                  > > Nullable="No"/>
                  > > <Column Name="ITEM_QUANTITY"
                  DataType="INTEGER"
                  > > Length="6" Nullable="No"/>
                  > > <PrimaryKey>
                  > > <UseColumn Name="ORDER_ID"/>
                  > > <UseColumn Name="ITEM_ID"
                  > > KeyGenerator="Database"/>
                  > > </PrimaryKey>
                  > > <ForeignKey Name="FK_ORDER">
                  > > <UseTable Name="TEST_ORDER" />
                  > > <UseUniqueKey Name="PrimaryKey" />
                  > > <UseColumn Name="ORDER_ID"/>
                  > > </ForeignKey>
                  > > </Table>
                  > > </Schema>
                  > > </Catalog>
                  > > </Database>
                  > > </Databases>
                  > > <Maps>
                  > > <ClassMap>
                  > > <ElementType Name="customer"/>
                  > > <ToClassTable Name="TEST_CUSTOMER"/>
                  > > <PropertyMap>
                  > > <ElementType Name="customerid"/>
                  > > <ToColumn Name="CUSTOMER_ID"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="custname"/>
                  > > <ToColumn Name="CUSTOMER_NAME"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="street"/>
                  > > <ToColumn Name="STREET"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="city"/>
                  > > <ToColumn Name="CITY"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="state"/>
                  > > <ToColumn Name="STATE"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="postcode"/>
                  > > <ToColumn Name="POST_CODE"/>
                  > > </PropertyMap>
                  > > </ClassMap>
                  > > <ClassMap>
                  > > <ElementType Name="order"/>
                  > > <ToClassTable Name="TEST_ORDER"/>
                  > > <PropertyMap>
                  > > <ElementType Name="id"/>
                  > > <ToColumn Name="ORDER_ID"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="title"/>
                  > > <ToColumn Name="ORDER_TITLE"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="customerid"/>
                  > > <ToColumn Name="CUSTOMER_ID"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="orderdate"/>
                  > > <ToColumn Name="ORDER_DATE"/>
                  > > </PropertyMap>
                  > > <RelatedClass KeyInParentTable="Foreign">
                  > > <ElementType Name="customer"/>
                  > > <UseUniqueKey Name="PrimaryKey"/>
                  > > <UseForeignKey Name="FK_CUSTOMER"/>
                  > > </RelatedClass>
                  > > <RelatedClass KeyInParentTable="Unique">
                  > > <ElementType Name="item"/>
                  > > <UseUniqueKey Name="PrimaryKey"/>
                  > > <UseForeignKey Name="FK_ORDER"/>
                  > > <OrderColumn Name="ITEM_ID"
                  Direction="Ascending" />
                  > > </RelatedClass>
                  > > </ClassMap>
                  > > <ClassMap>
                  > > <ElementType Name="item"/>
                  > > <ToClassTable Name="TEST_ITEM"/>
                  > > <PropertyMap>
                  > > <ElementType Name="itemid"/>
                  > > <ToColumn Name="ITEM_ID"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="id"/>
                  > > <ToColumn Name="ORDER_ID"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="description"/>
                  > > <ToColumn Name="ITEM_DESCRIPTION"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="price"/>
                  > > <ToColumn Name="ITEM_PRICE"/>
                  > > </PropertyMap>
                  > > <PropertyMap>
                  > > <ElementType Name="quantity"/>
                  > > <ToColumn Name="ITEM_QUANTITY"/>
                  > > </PropertyMap>
                  > > <RelatedClass KeyInParentTable="Foreign">
                  > > <ElementType Name="order"/>
                  > > <UseUniqueKey Name="PrimaryKey"/>
                  > > <UseForeignKey Name="FK_ORDER"/>
                  > > </RelatedClass>
                  > > </ClassMap>
                  > > </Maps>
                  > > </XMLToDBMS>
                  > >
                  > > I still think this is somehow bound up in the relationship
                  between
                  > > the tables and the keys used to relate them...
                  > >
                  > > Again thanks for any help.
                  > >
                  > >
                  > > Scott.
                Your message has been successfully submitted and would be delivered to recipients shortly.