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

Re: [xml-dbms] Recursive problem

Expand Messages
  • rpbourret@rpbourret.com
    To map an element recursively, you need two things: 1) The table to which the element is mapped must contain a foreign key pointing to itself, and 2) The
    Message 1 of 2 , Dec 24, 2002
    • 0 Attachment
      To map an element recursively, you need two things:

      1) The table to which the element is mapped must contain a foreign key pointing
      to itself, and

      2) The ClassMap for the element must contain a RelatedClass map pointing to the
      ClassMap.

      Suppose your ACTIVITY table looks like this

      ACTIVITY (ActivityID, ParentActivityID, ...)

      Then your map should look like this:

      <ClassMap>
      <ElementType Name="act:activity"/>
      <ToClassTable Name="ACTIVITY"/>
      <PropertyMap>
      ...............
      </PropertyMap>
      <RelatedClass KeyInParentTable="Unique">
      <ElementType Name="act:activity"/>
      <UseUniqueKey Name="name of key pointing to ActivityID">
      <UseForeignKey Name="name of key pointing to ParentActivityID">
      </RelatedClass>
      </ClassMap>

      Also, I assume that you have namespaces set up correctly, as detailed in:

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

      -- Ron

      > I want to be able to store an activity element which in turn stores
      > an activity element.
      > <activities>
      > <activity>
      > ......
      > ......
      > <activity>
      > ......
      > ......
      > </activity>
      > <activity>
      > ......
      > ......
      > </activity>
      > </activity>
      > </activities>
      >
      > I am able to map an activity type element fine but xmldbms seems to
      > ignore any child <activity> elements.It is mapped as follows:
      >
      > <ClassMap>
      > <ElementType Name="act:activity"/>
      > <ToClassTable Name="ACTIVITY"/>
      > <PropertyMap>
      > ...............
      > </PropertyMap>
      > <RelatedClass KeyInParentTable="Unique">
      > ..................
      > </RelatedClass>
      > </ClassMap>
      >
      > I think it what is happening is that because the activity element is
      > not explicitly mapped within the activity class map is is not being
      > recognised.Any suggestions would be greatly
      appreciated.
    Your message has been successfully submitted and would be delivered to recipients shortly.