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

Problem with map- Files (multiple RelatedClass sections/ resolve nested element)

Expand Messages
  • uwez2004
    Hallo, ... i ve got more than one Attributes with foreignkeys in one table referencing another(and only this table) table. In the mapping File i resolve the
    Message 1 of 2 , Jun 3, 2004
    • 0 Attachment
      Hallo,

      1. Question:
      ------------
      i've got more than one Attributes with foreignkeys in one table
      referencing another(and only this table) table.
      In the mapping File i resolve the first fk with the following
      RelatedClass section in the classMap section:

      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_constant"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_article2_to_constant"/>
      </RelatedClass>

      but, there are more than this fk, and when i add the next
      RelatedClass element:

      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_constant"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_article5_to_constant"/>
      </RelatedClass>

      ..it complains:

      "Child element type tbl_constant already mapped for element type
      tbl_article"

      XMLDBMS is right, but how can i handle that?

      2. Question:
      ------------
      I don't need to have all the attributes nested from the referenced
      table. So i thought i couldt use the InlineMap element to avoid using
      xslt to remove the wrapping element. But when i use the following
      statement in the referencing table:

      <InlineMap>
      <ElementType Name="tbl_constant" />
      <PropertyMap>
      <ElementType Name="cst_text"/>
      <ToColumn Name="CST_TEXT"/>
      </PropertyMap>
      </InlineMap>

      .. it say's:

      "Property column CST_TEXT not found in
      table "Default"."".""."TBL_ARTICLE"
      "
      --> xmldbms is right, it's in the referenced table TBL_CONSTANT.

      So i guess i did not understand the use of InlineMap in order to
      REMOVE wrapping elements while it retrieves Data from the Database to
      XML-File.

      thank you, i realy appreciate your help!

      Uwe


      The approriate mapping- Files:
      ==============================
      map.map for Question 1:
      -----------------------

      <?xml version='1.0' ?>
      <XMLToDBMS Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
      <Options>
      <SimpleDateFormat Pattern="yyyy-MM-dd" DefaultForTypes="DATE" />
      <DecimalFormat Pattern="########" DefaultForTypes="INTEGER" />
      <FormatClass
      Class="org.xmlmiddleware.conversions.formatters.external.Base64Formatt
      er"
      DefaultForTypes="BINARY VARBINARY LONGVARBINARY" />
      </Options>
      <Databases>
      <Database Name="Default">
      <Catalog>
      <Schema>
      <Table Name="TBL_POST">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="PST_VISIBLE" DataType="INTEGER" Length="1"
      Nullable="No"/>
      <Column Name="PAR_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_CONSTANT">
      <Column Name="CST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CST_GRPID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CST_TEXT" DataType="VARCHAR" Length="100"
      Nullable="No"/>
      <Column Name="CST_TYPE" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="CST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_CONTACT">
      <Column Name="CON_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CON_NAME" DataType="VARCHAR" Length="100"
      Nullable="No"/>
      <Column Name="CON_FIRSTNAME" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <Column Name="CON_PHONE" DataType="VARCHAR" Length="30"
      Nullable="Yes"/>
      <Column Name="CON_FAX" DataType="VARCHAR" Length="30"
      Nullable="Yes"/>
      <Column Name="CON_EMAIL" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <Column Name="TIT_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="PAR_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <ForeignKey Name="fk_contact_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIT_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="CON_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_ARTICLE">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="ART_VIEWS" DataType="INTEGER" Length="6"
      Nullable="No"/>
      <Column Name="ART_TIMEOFENTRY" DataType="DATE" Nullable="No"/>
      <Column Name="ART_TIMEOFBEGIN" DataType="DATE"
      Nullable="No"/>
      <Column Name="ART_TITLE" DataType="VARCHAR" Length="300"
      Nullable="No"/>
      <Column Name="ART_ZIPCODEAREA" DataType="VARCHAR" Length="5"
      Nullable="Yes"/>
      <Column Name="ART_DESCRIPTION" DataType="VARCHAR"
      Length="4000" Nullable="Yes"/>
      <Column Name="ART_REQUIREMENTS" DataType="VARCHAR"
      Length="4000" Nullable="Yes"/>
      <Column Name="ART_SALARY" DataType="INTEGER" Length="20"
      Nullable="Yes"/>
      <Column Name="ART_EXPIRY" DataType="DATE" Nullable="No"/>
      <Column Name="CON_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="TIM_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CRS_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="SAL_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="TYP_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="ART_EXPIRYINFO" DataType="DATE" Nullable="Yes"/>
      <Column Name="TIMEOFBEGIN_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      <ForeignKey Name="fk_to_post">
      <UseTable Name="TBL_POST" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article3_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIM_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_contact">
      <UseTable Name="TBL_CONTACT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="CON_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article2_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="CRS_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article1_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="SAL_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article5_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TYP_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article6_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIMEOFBEGIN_ID"/>
      </ForeignKey>

      </Table>
      <Table Name="TBL_FULLTIME">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <ForeignKey Name="fk_fulltime_to_article">
      <UseTable Name="TBL_ARTICLE" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_TRAINEE">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="TRA_PROFESSOR" DataType="VARCHAR" Length="50"
      Nullable="Yes"/>
      <Column Name="TRA_DIPLOMATE" DataType="VARCHAR" Length="1"
      Nullable="Yes"/>
      <ForeignKey Name="fk_trainee_to_article">
      <UseTable Name="TBL_ARTICLE" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      </Schema>
      </Catalog>
      </Database>
      </Databases>
      <Maps>
      <ClassMap>
      <ElementType Name="tbl_contact"/>
      <ToClassTable Name="TBL_CONTACT"/>
      <PropertyMap>
      <ElementType Name="con_id"/>
      <ToColumn Name="CON_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_name"/>
      <ToColumn Name="CON_NAME"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_firstname"/>
      <ToColumn Name="CON_FIRSTNAME"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_phone"/>
      <ToColumn Name="CON_PHONE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_fax"/>
      <ToColumn Name="CON_FAX"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_email"/>
      <ToColumn Name="CON_EMAIL"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="tit_id"/>
      <ToColumn Name="TIT_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="par_id"/>
      <ToColumn Name="PAR_ID"/>
      </PropertyMap>

      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_post"/>
      <ToClassTable Name="TBL_POST"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="pst_visible"/>
      <ToColumn Name="PST_VISIBLE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="par_id"/>
      <ToColumn Name="PAR_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_constant"/>
      <ToClassTable Name="TBL_CONSTANT"/>
      <PropertyMap>
      <ElementType Name="cst_id"/>
      <ToColumn Name="CST_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_grpid"/>
      <ToColumn Name="CST_GRPID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_text"/>
      <ToColumn Name="CST_TEXT"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_type"/>
      <ToColumn Name="CST_TYPE"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_fulltime"/>
      <ToClassTable Name="TBL_FULLTIME"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_trainee"/>
      <ToClassTable Name="TBL_TRAINEE"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_article"/>
      <ToClassTable Name="TBL_ARTICLE"/>
      <PropertyMap>
      <ElementType Name="typ_id"/>
      <ToColumn Name="TYP_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_title"/>
      <ToColumn Name="ART_TITLE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_zipcodearea"/>
      <ToColumn Name="ART_ZIPCODEAREA"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_salary"/>
      <ToColumn Name="ART_SALARY"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_description"/>
      <ToColumn Name="ART_DESCRIPTION"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_requirements"/>
      <ToColumn Name="ART_REQUIREMENTS"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_contact"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_contact"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_post"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_to_post"/>
      </RelatedClass>

      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_constant"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_article2_to_constant"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_constant"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_article5_to_constant"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="tbl_fulltime"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_fulltime_to_article"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="tbl_trainee"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_trainee_to_article"/>
      </RelatedClass>
      </ClassMap>
      </Maps>
      </XMLToDBMS>

      ------------------------------------------------------
      map.map for Question 2:
      -----------------------

      <?xml version='1.0' ?>
      <XMLToDBMS Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
      <Options>
      <SimpleDateFormat Pattern="yyyy-MM-dd" DefaultForTypes="DATE" />
      <DecimalFormat Pattern="########" DefaultForTypes="INTEGER" />
      <FormatClass
      Class="org.xmlmiddleware.conversions.formatters.external.Base64Formatt
      er"
      DefaultForTypes="BINARY VARBINARY LONGVARBINARY" />
      </Options>
      <Databases>
      <Database Name="Default">
      <Catalog>
      <Schema>
      <Table Name="TBL_POST">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="PST_VISIBLE" DataType="INTEGER" Length="1"
      Nullable="No"/>
      <Column Name="PAR_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_CONSTANT">
      <Column Name="CST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CST_GRPID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CST_TEXT" DataType="VARCHAR" Length="100"
      Nullable="No"/>
      <Column Name="CST_TYPE" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="CST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_CONTACT">
      <Column Name="CON_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CON_NAME" DataType="VARCHAR" Length="100"
      Nullable="No"/>
      <Column Name="CON_FIRSTNAME" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <Column Name="CON_PHONE" DataType="VARCHAR" Length="30"
      Nullable="Yes"/>
      <Column Name="CON_FAX" DataType="VARCHAR" Length="30"
      Nullable="Yes"/>
      <Column Name="CON_EMAIL" DataType="VARCHAR" Length="100"
      Nullable="Yes"/>
      <Column Name="TIT_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="PAR_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <ForeignKey Name="fk_contact_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIT_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="CON_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_ARTICLE">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="ART_VIEWS" DataType="INTEGER" Length="6"
      Nullable="No"/>
      <Column Name="ART_TIMEOFENTRY" DataType="DATE" Nullable="No"/>
      <Column Name="ART_TIMEOFBEGIN" DataType="DATE"
      Nullable="No"/>
      <Column Name="ART_TITLE" DataType="VARCHAR" Length="300"
      Nullable="No"/>
      <Column Name="ART_ZIPCODEAREA" DataType="VARCHAR" Length="5"
      Nullable="Yes"/>
      <Column Name="ART_DESCRIPTION" DataType="VARCHAR"
      Length="4000" Nullable="Yes"/>
      <Column Name="ART_REQUIREMENTS" DataType="VARCHAR"
      Length="4000" Nullable="Yes"/>
      <Column Name="ART_SALARY" DataType="INTEGER" Length="20"
      Nullable="Yes"/>
      <Column Name="ART_EXPIRY" DataType="DATE" Nullable="No"/>
      <Column Name="CON_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="TIM_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="CRS_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="SAL_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="TYP_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <Column Name="ART_EXPIRYINFO" DataType="DATE" Nullable="Yes"/>
      <Column Name="TIMEOFBEGIN_ID" DataType="INTEGER" Length="8"
      Nullable="Yes"/>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      <ForeignKey Name="fk_to_post">
      <UseTable Name="TBL_POST" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article3_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIM_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_contact">
      <UseTable Name="TBL_CONTACT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="CON_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article2_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="CRS_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article1_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="SAL_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article5_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TYP_ID"/>
      </ForeignKey>
      <ForeignKey Name="fk_article6_to_constant">
      <UseTable Name="TBL_CONSTANT" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="TIMEOFBEGIN_ID"/>
      </ForeignKey>

      </Table>
      <Table Name="TBL_FULLTIME">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <ForeignKey Name="fk_fulltime_to_article">
      <UseTable Name="TBL_ARTICLE" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      <Table Name="TBL_TRAINEE">
      <Column Name="PST_ID" DataType="INTEGER" Length="8"
      Nullable="No"/>
      <Column Name="TRA_PROFESSOR" DataType="VARCHAR" Length="50"
      Nullable="Yes"/>
      <Column Name="TRA_DIPLOMATE" DataType="VARCHAR" Length="1"
      Nullable="Yes"/>
      <ForeignKey Name="fk_trainee_to_article">
      <UseTable Name="TBL_ARTICLE" />
      <UseUniqueKey Name="PrimaryKey" />
      <UseColumn Name="PST_ID"/>
      </ForeignKey>
      <PrimaryKey KeyGenerator="UID">
      <UseColumn Name="PST_ID"/>
      </PrimaryKey>
      </Table>
      </Schema>
      </Catalog>
      </Database>
      </Databases>
      <Maps>
      <ClassMap>
      <ElementType Name="tbl_contact"/>
      <ToClassTable Name="TBL_CONTACT"/>
      <PropertyMap>
      <ElementType Name="con_id"/>
      <ToColumn Name="CON_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_name"/>
      <ToColumn Name="CON_NAME"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_firstname"/>
      <ToColumn Name="CON_FIRSTNAME"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_phone"/>
      <ToColumn Name="CON_PHONE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_fax"/>
      <ToColumn Name="CON_FAX"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="con_email"/>
      <ToColumn Name="CON_EMAIL"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="tit_id"/>
      <ToColumn Name="TIT_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="par_id"/>
      <ToColumn Name="PAR_ID"/>
      </PropertyMap>

      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_post"/>
      <ToClassTable Name="TBL_POST"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="pst_visible"/>
      <ToColumn Name="PST_VISIBLE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="par_id"/>
      <ToColumn Name="PAR_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_constant"/>
      <ToClassTable Name="TBL_CONSTANT"/>
      <PropertyMap>
      <ElementType Name="cst_id"/>
      <ToColumn Name="CST_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_grpid"/>
      <ToColumn Name="CST_GRPID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_text"/>
      <ToColumn Name="CST_TEXT"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="cst_type"/>
      <ToColumn Name="CST_TYPE"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_fulltime"/>
      <ToClassTable Name="TBL_FULLTIME"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_trainee"/>
      <ToClassTable Name="TBL_TRAINEE"/>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      </ClassMap>
      <ClassMap>
      <ElementType Name="tbl_article"/>
      <ToClassTable Name="TBL_ARTICLE"/>

      <InlineMap>
      <ElementType Name="tbl_constant" />
      <PropertyMap>
      <ElementType Name="cst_text"/>
      <ToColumn Name="CST_TEXT"/>
      </PropertyMap>
      </InlineMap>

      <PropertyMap>
      <ElementType Name="typ_id"/>
      <ToColumn Name="TYP_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_title"/>
      <ToColumn Name="ART_TITLE"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_zipcodearea"/>
      <ToColumn Name="ART_ZIPCODEAREA"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_salary"/>
      <ToColumn Name="ART_SALARY"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_description"/>
      <ToColumn Name="ART_DESCRIPTION"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="art_requirements"/>
      <ToColumn Name="ART_REQUIREMENTS"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="pst_id"/>
      <ToColumn Name="PST_ID"/>
      </PropertyMap>
      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_contact"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_contact"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_post"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_to_post"/>
      </RelatedClass>

      <RelatedClass KeyInParentTable="Foreign">
      <ElementType Name="tbl_constant"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_article2_to_constant"/>
      </RelatedClass>

      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="tbl_fulltime"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_fulltime_to_article"/>
      </RelatedClass>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="tbl_trainee"/>
      <UseUniqueKey Name="PrimaryKey"/>
      <UseForeignKey Name="fk_trainee_to_article"/>
      </RelatedClass>
      </ClassMap>
      </Maps>
      </XMLToDBMS>
    • Ronald Bourret
      See below. ... The problem here is that you want to map the tbl_constant element in two different ways. Even though both map to the same table, you want the
      Message 2 of 2 , Jun 21, 2004
      • 0 Attachment
        See below.

        uwez2004 wrote:
        >
        > Hallo,
        >
        > 1. Question:
        > ------------
        > i've got more than one Attributes with foreignkeys in one table
        > referencing another(and only this table) table.
        > In the mapping File i resolve the first fk with the following
        > RelatedClass section in the classMap section:
        >
        > <RelatedClass KeyInParentTable="Foreign">
        > <ElementType Name="tbl_constant"/>
        > <UseUniqueKey Name="PrimaryKey"/>
        > <UseForeignKey Name="fk_article2_to_constant"/>
        > </RelatedClass>
        >
        > but, there are more than this fk, and when i add the next
        > RelatedClass element:
        >
        > <RelatedClass KeyInParentTable="Foreign">
        > <ElementType Name="tbl_constant"/>
        > <UseUniqueKey Name="PrimaryKey"/>
        > <UseForeignKey Name="fk_article5_to_constant"/>
        > </RelatedClass>
        >
        > ..it complains:
        >
        > "Child element type tbl_constant already mapped for element type
        > tbl_article"
        >
        > XMLDBMS is right, but how can i handle that?

        The problem here is that you want to map the tbl_constant element in two
        different ways. Even though both map to the same table, you want the
        foreign keys referencing this table to be stored in two different
        columns in the parent table. From XML-DBMS's point of view, this means
        that these are two different elements.

        The following should work, but I don't have time to check it here:

        1) In your XML documents, rename the tbl_constant elements to
        tbl_constant1 and tbl_constant2 depending on how you want them mapped.

        2) In your map document, leave the current ClassMap for tbl_constant.
        Also add ClassMaps for tbl_constant1 and tbl_constant2; in these
        ClassMaps, use a UseClassMap child that points to the ClassMap for
        tbl_constant. For more information, see the description of UseClassMap
        in xmldbms2.dtd; the address / ship-to address / bill-to address example
        applies to your case.

        3) In the ClassMap for tbl_article, modify the RelatedClass elements for
        tbl_constant so that one is for tbl_constant1 and the other is for
        tbl_constant2.

        > 2. Question:
        > ------------
        > I don't need to have all the attributes nested from the referenced
        > table. So i thought i couldt use the InlineMap element to avoid using
        > xslt to remove the wrapping element. But when i use the following
        > statement in the referencing table:
        >
        > <InlineMap>
        > <ElementType Name="tbl_constant" />
        > <PropertyMap>
        > <ElementType Name="cst_text"/>
        > <ToColumn Name="CST_TEXT"/>
        > </PropertyMap>
        > </InlineMap>
        >
        > .. it say's:
        >
        > "Property column CST_TEXT not found in
        > table "Default"."".""."TBL_ARTICLE"
        > "
        > --> xmldbms is right, it's in the referenced table TBL_CONSTANT.
        >
        > So i guess i did not understand the use of InlineMap in order to
        > REMOVE wrapping elements while it retrieves Data from the Database to
        > XML-File.

        InlineMap removes wrapping elements while transferring data from XML to
        the database, not the other way around. For more information, see:

        http://groups.yahoo.com/group/xml-dbms/message/3345

        I haven't implemented code to do what you want to do.

        -- Ron
      Your message has been successfully submitted and would be delivered to recipients shortly.