3 Replies Latest reply on Apr 8, 2005 12:59 AM by 3004

    Horizontal mapping with superclass having a collection

    3004
      hi all,
      I get following exception when try following scenerio

      kodo.jdbc.meta.MappingInfoNotFoundException: The join specification for
      "com_daffodil_activityscheduler.bdo.Attachment.workProduct" using mapping
      type "one-one" is not valid: no table named "null" was
      found.[com_daffodil_activityscheduler.bdo.Attachment.workProduct]
      at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:132)
      at kodo.jdbc.meta.Mappings.invalidForeignKey(Mappings.java:404)
      at kodo.jdbc.meta.Mappings.getForeignKey(Mappings.java:286)
      at
      kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapping.java:130)
      at
      kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)



      The Scenerio is

      abstract public class WorkProduct {

      private String name;
      private String description;

      public java.util.Collection attachments;
      }

      public class Dependent {

      public RequirementWorkProduct parentRequirement;
      public RequirementWorkProduct childRequirement;
      }


      abstract public class RequirementWorkProduct extends WorkProduct {


      public java.util.Collection dependents;
      public java.util.Collection dependencies;
      }

      public class Feature extends RequirementWorkProduct {
      ...fields are not shown
      }

      public class Attachment {

      private String detail;
      private String fileToAttach;

      public WorkProduct workProduct;
      }

      The JDO metadata for WorkProduct is

      <jdo>
      <package name="com_daffodil_activityscheduler.bdo">

      <class name ="WorkProduct">
      <extension vendor-name="kodo" key="jdbc-class-map-name"
      value="horizontal"/>
      <field name="name"/>
      <field name="description"/>
      <field name="attachments" >
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Attachment">
      <extension vendor-name="kodo" key="inverse-owner"
      value="workProduct"/>
      <extension vendor-name="kodo" key="element-dependent"
      value="true"/>
      </collection>
      </field>
      </class>
      </package>
      </jdo>

      The JDO metadata for Dependent

      <jdo>
      <package name="com_daffodil_activityscheduler.bdo">

      <class name ="Dependent">
      <field name="parentRequirement">
      <extension vendor-name="kodo" key="fetch-group"
      value="dependent.parentRequirement"/>
      </field>
      <field name="childRequirement">
      <extension vendor-name="kodo" key="fetch-group"
      value="dependent.childRequirement"/>
      </field>
      </class>
      </package>
      </jdo>

      The JDO metadata for RequirementWorkProduct is

      <jdo>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name ="RequirementWorkProduct"
      persistence-capable-superclass="WorkProduct">
      <extension vendor-name="kodo" key="jdbc-class-map-name"
      value="horizontal"/>
      <field name="dependents">
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Dependent">
      <extension vendor-name="kodo" key="fetch-group"
      value="parentRequirement.dependents"/>
      <extension vendor-name="kodo" key="inverse-owner"
      value="parentRequirement"/>
      <extension vendor-name="kodo" key="element-dependent"
      value="true"/>
      </collection>
      </field>
      <field name="dependencies">
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Dependent">
      <extension vendor-name="kodo" key="fetch-group"
      value="childRequirement.dependencies"/>
      <extension vendor-name="kodo" key="inverse-owner"
      value="childRequirement"/>
      <extension vendor-name="kodo" key="element-dependent"
      value="true"/>
      </collection>
      </field>
      </class>
      </package>
      </jdo>

      The JDO metadata for Feature is

      <jdo>
      <package name="com_daffodil_activityscheduler.bdo">

      <class name ="Feature"
      persistence-capable-superclass="RequirementWorkProduct">
      <extension vendor-name="kodo" key="jdbc-class-map-name"
      value="base"/>
      <extension vendor-name="kodo" key="detachable" value="true"/>

      ...field meta data
      </class>
      </package>
      </jdo>


      JDO metaData for Attachmet

      <jdo>
      <package name="com_daffodil_activityscheduler.bdo">

      <class name ="Attachment">
      <extension vendor-name="kodo" key="detachable" value="true"/>
      <field name="detail">
      <extension vendor-name="daffodil" key="display-name" value="Detail"
      />
      <extension vendor-name="daffodil" key="display-width" value="100" />
      </field>
      <field name="fileToAttach">
      <extension vendor-name="daffodil" key="display-name"
      value="FileToAttach" />
      <extension vendor-name="daffodil" key="display-width" value="100" />
      </field>
      <field name="workProduct">
      <extension vendor-name="kodo" key="fetch-group"
      value="attachment.workProduct"/>
      </field>
      </class>
      </package>
      </jdo>


      The mapping file for WorkProduct is

      <mapping>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name="WorkProduct">
                <jdbc-class-map type="horizontal"/>
           </class>
      </package>
      </mapping>

      The mapping for Dependent is

      <mapping>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name ="Dependent">
      <jdbc-class-map type="base" pk-column= "DependentId"
      table="Dependent"/>
      <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
      <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
      <field name="parentRequirement">
      <jdbc-field-map type="one-one"
      column.WORKPRODUCTID="PARENTREQUIREMENTID"/>
      </field>
      <field name="childRequirement">
      <jdbc-field-map type="one-one"
      column.WORKPRODUCTID="CHILDREQUIREMENTID"/>
      </field>
      </class>
      </package>
      </mapping>

      The mapping file for RequirementWorkProduct is

      <mapping>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name="RequirementWorkProduct">
                <jdbc-class-map type="horizontal"/>
           </class>
      </package>
      </mapping>


      The mapping file for Feature is
      <mapping>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name ="Feature"
      persistence-capable-superclass="RequirementWorkProduct">
      <jdbc-class-map type="base" pk-column= "WorkProductId"
      table="Feature"/>
      <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
      <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
      <field name="com_daffodil_activityscheduler.bdo.WorkProduct.name">
      <jdbc-field-map type="value" column="NAME" />
      </field>
      <field
      name="com_daffodil_activityscheduler.bdo.WorkProduct.description">
      <jdbc-field-map type="value" column="DESCRIPTION" />
      </field>
      <field
      name="com_daffodil_activityscheduler.bdo.WorkProduct.attachments">
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Attachment">
      <jdbc-field-map type="one-many"
      ref-column.WorkProductId="WorkProductId" table="ATTACHMENT"/>
      </collection>
      </field>
      <field name="RequirementWorkProduct.dependents">
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Dependent">
      <jdbc-field-map type="one-many"
      ref-column.WorkProductId="ParentWorkProductId" table="DEPENDENT"/>
      </collection>
      </field>
      <field name="RequirementWorkProduct.dependencies">
      <collection
      element-type="com_daffodil_activityscheduler.bdo.Dependent">
      <jdbc-field-map type="one-many"
      ref-column.WorkProductId="ChildWorkProductId" table="DEPENDENT"/>
      </collection>
      </field>
      </class>
      </package>
      </mapping>

      The mapping for Attachment

      <mapping>
      <package name="com_daffodil_activityscheduler.bdo">
      <class name ="Attachment">
      <jdbc-class-map type="base" pk-column= "AttachementId"
      table="Attachment"/>
      <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
      <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
      <field name="detail">
      <jdbc-field-map type="value" column="DETAIL" />
      </field>
      <field name="fileToAttach">
      <jdbc-field-map type="value" column="FILETOATTACH" />
      </field>
      <field name="workProduct">
      <jdbc-field-map type="one-one"
      column.WORKPRODUCTID="WORKPRODUCTID"/>
      </field>
      </class>
      </package>
      </mapping>


      The fileds in Feature table are
      workProductId (Pk column)
      name
      description
      notes
      .....


      The fields in Dependent table are

      dependentId (Pk column)
      parentWorkProductId
      childWorkProductId

      The fileds in Attachment table are

      attachementId (pk column)
      workProductId
      detail
      fileToAttach

      Every table has version indicator and class indicator fields.















        • 1. Re: Horizontal mapping with superclass having a collection
          3004
          You cannot map a horizontally mapped class as the target one-one as
          there is no table to relate to. You have to use the pc mapping.
          Alternatively, if you know the concretely mapped type of the WorkProduct
          (i.e. feature), you can set the "type" extension to it so that Kodo can
          more concretely relate the two.

          Are there siblings to feature? If not, you may just want to map its
          superclasses as base/flat mappings.

          Gajendra wrote:
          hi all,
          I get following exception when try following scenerio

          kodo.jdbc.meta.MappingInfoNotFoundException: The join specification for
          "com_daffodil_activityscheduler.bdo.Attachment.workProduct" using mapping
          type "one-one" is not valid: no table named "null" was
          found.[com_daffodil_activityscheduler.bdo.Attachment.workProduct]
          at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:132)
          at kodo.jdbc.meta.Mappings.invalidForeignKey(Mappings.java:404)
          at kodo.jdbc.meta.Mappings.getForeignKey(Mappings.java:286)
          at
          kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapping.java:130)
          at
          kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)



          The Scenerio is

          abstract public class WorkProduct {

          private String name;
          private String description;

          public java.util.Collection attachments;
          }

          public class Dependent {

          public RequirementWorkProduct parentRequirement;
          public RequirementWorkProduct childRequirement;
          }


          abstract public class RequirementWorkProduct extends WorkProduct {


          public java.util.Collection dependents;
          public java.util.Collection dependencies;
          }

          public class Feature extends RequirementWorkProduct {
          ...fields are not shown
          }

          public class Attachment {

          private String detail;
          private String fileToAttach;

          public WorkProduct workProduct;
          }

          The JDO metadata for WorkProduct is

          <jdo>
          <package name="com_daffodil_activityscheduler.bdo">

          <class name ="WorkProduct">
          <extension vendor-name="kodo" key="jdbc-class-map-name"
          value="horizontal"/>
          <field name="name"/>
          <field name="description"/>
          <field name="attachments" >
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Attachment">
          <extension vendor-name="kodo" key="inverse-owner"
          value="workProduct"/>
          <extension vendor-name="kodo" key="element-dependent"
          value="true"/>
          </collection>
          </field>
          </class>
          </package>
          </jdo>

          The JDO metadata for Dependent

          <jdo>
          <package name="com_daffodil_activityscheduler.bdo">

          <class name ="Dependent">
          <field name="parentRequirement">
          <extension vendor-name="kodo" key="fetch-group"
          value="dependent.parentRequirement"/>
          </field>
          <field name="childRequirement">
          <extension vendor-name="kodo" key="fetch-group"
          value="dependent.childRequirement"/>
          </field>
          </class>
          </package>
          </jdo>

          The JDO metadata for RequirementWorkProduct is

          <jdo>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name ="RequirementWorkProduct"
          persistence-capable-superclass="WorkProduct">
          <extension vendor-name="kodo" key="jdbc-class-map-name"
          value="horizontal"/>
          <field name="dependents">
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Dependent">
          <extension vendor-name="kodo" key="fetch-group"
          value="parentRequirement.dependents"/>
          <extension vendor-name="kodo" key="inverse-owner"
          value="parentRequirement"/>
          <extension vendor-name="kodo" key="element-dependent"
          value="true"/>
          </collection>
          </field>
          <field name="dependencies">
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Dependent">
          <extension vendor-name="kodo" key="fetch-group"
          value="childRequirement.dependencies"/>
          <extension vendor-name="kodo" key="inverse-owner"
          value="childRequirement"/>
          <extension vendor-name="kodo" key="element-dependent"
          value="true"/>
          </collection>
          </field>
          </class>
          </package>
          </jdo>

          The JDO metadata for Feature is

          <jdo>
          <package name="com_daffodil_activityscheduler.bdo">

          <class name ="Feature"
          persistence-capable-superclass="RequirementWorkProduct">
          <extension vendor-name="kodo" key="jdbc-class-map-name"
          value="base"/>
          <extension vendor-name="kodo" key="detachable" value="true"/>

          ...field meta data
          </class>
          </package>
          </jdo>


          JDO metaData for Attachmet

          <jdo>
          <package name="com_daffodil_activityscheduler.bdo">

          <class name ="Attachment">
          <extension vendor-name="kodo" key="detachable" value="true"/>
          <field name="detail">
          <extension vendor-name="daffodil" key="display-name" value="Detail"
          />
          <extension vendor-name="daffodil" key="display-width" value="100" />
          </field>
          <field name="fileToAttach">
          <extension vendor-name="daffodil" key="display-name"
          value="FileToAttach" />
          <extension vendor-name="daffodil" key="display-width" value="100" />
          </field>
          <field name="workProduct">
          <extension vendor-name="kodo" key="fetch-group"
          value="attachment.workProduct"/>
          </field>
          </class>
          </package>
          </jdo>


          The mapping file for WorkProduct is

          <mapping>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name="WorkProduct">
                    <jdbc-class-map type="horizontal"/>
               </class>
          </package>
          </mapping>

          The mapping for Dependent is

          <mapping>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name ="Dependent">
          <jdbc-class-map type="base" pk-column= "DependentId"
          table="Dependent"/>
          <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
          <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
          <field name="parentRequirement">
          <jdbc-field-map type="one-one"
          column.WORKPRODUCTID="PARENTREQUIREMENTID"/>
          </field>
          <field name="childRequirement">
          <jdbc-field-map type="one-one"
          column.WORKPRODUCTID="CHILDREQUIREMENTID"/>
          </field>
          </class>
          </package>
          </mapping>

          The mapping file for RequirementWorkProduct is

          <mapping>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name="RequirementWorkProduct">
                    <jdbc-class-map type="horizontal"/>
               </class>
          </package>
          </mapping>


          The mapping file for Feature is
          <mapping>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name ="Feature"
          persistence-capable-superclass="RequirementWorkProduct">
          <jdbc-class-map type="base" pk-column= "WorkProductId"
          table="Feature"/>
          <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
          <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
          <field name="com_daffodil_activityscheduler.bdo.WorkProduct.name">
          <jdbc-field-map type="value" column="NAME" />
          </field>
          <field
          name="com_daffodil_activityscheduler.bdo.WorkProduct.description">
          <jdbc-field-map type="value" column="DESCRIPTION" />
          </field>
          <field
          name="com_daffodil_activityscheduler.bdo.WorkProduct.attachments">
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Attachment">
          <jdbc-field-map type="one-many"
          ref-column.WorkProductId="WorkProductId" table="ATTACHMENT"/>
          </collection>
          </field>
          <field name="RequirementWorkProduct.dependents">
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Dependent">
          <jdbc-field-map type="one-many"
          ref-column.WorkProductId="ParentWorkProductId" table="DEPENDENT"/>
          </collection>
          </field>
          <field name="RequirementWorkProduct.dependencies">
          <collection
          element-type="com_daffodil_activityscheduler.bdo.Dependent">
          <jdbc-field-map type="one-many"
          ref-column.WorkProductId="ChildWorkProductId" table="DEPENDENT"/>
          </collection>
          </field>
          </class>
          </package>
          </mapping>

          The mapping for Attachment

          <mapping>
          <package name="com_daffodil_activityscheduler.bdo">
          <class name ="Attachment">
          <jdbc-class-map type="base" pk-column= "AttachementId"
          table="Attachment"/>
          <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
          <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
          <field name="detail">
          <jdbc-field-map type="value" column="DETAIL" />
          </field>
          <field name="fileToAttach">
          <jdbc-field-map type="value" column="FILETOATTACH" />
          </field>
          <field name="workProduct">
          <jdbc-field-map type="one-one"
          column.WORKPRODUCTID="WORKPRODUCTID"/>
          </field>
          </class>
          </package>
          </mapping>


          The fileds in Feature table are
          workProductId (Pk column)
          name
          description
          notes
          ....


          The fields in Dependent table are

          dependentId (Pk column)
          parentWorkProductId
          childWorkProductId

          The fileds in Attachment table are

          attachementId (pk column)
          workProductId
          detail
          fileToAttach

          Every table has version indicator and class indicator fields.














          --
          Steve Kim
          skim@solarmetric.com
          SolarMetric Inc.
          http://www.solarmetric.com
          • 2. Re: Horizontal mapping with superclass having a collection
            3004
            Hi kim,
            Yes i have siblings to feature which are UseCase and
            OtherRequirement.Feature, UseCase and OtherRequirement extends the
            RequirementWorkProduct. A RequirementWorkProduct has two collection, one
            for dependents (The RequirementWorkProducts which are dependent on it) and
            other for dependencies (The RequirementWorkProducts on which it depend).
            Further the SuperClass of RequirementWorkProduct is WorkProduct, which has
            a Collection of Attachments. WorkProduct has two concrete class TestCase
            and Defect.
            To implementing this scenerio i have two ways. First one is by
            placing the collection in Common place means in RequirementWorkProduct
            (Which i really want to do). Second way is to place these collection
            sepratly in each subclass(which i think is inefficient). Also i want to
            use Horizontal mapping means Feature, UseCase, OtherRequirement, TestCase
            and Defect have their own tables which also contain the data for their
            SupeClasses and no tables for WorkProduct and RequirementWorkProduct.
            I can not use the "type" extension (as you said) because i don't
            know the mapped type (It may be a feature, useCase etc..).
            Now can you please tell me, what mapping should i use to implement
            this scenario, with example.

            Thanks
            Gajendra Singh



            Stephen Kim wrote:
            You cannot map a horizontally mapped class as the target one-one as
            there is no table to relate to. You have to use the pc mapping.
            Alternatively, if you know the concretely mapped type of the WorkProduct
            (i.e. feature), you can set the "type" extension to it so that Kodo can
            more concretely relate the two.
            Are there siblings to feature? If not, you may just want to map its
            superclasses as base/flat mappings.
            Gajendra wrote:
            hi all,
            I get following exception when try following scenerio

            kodo.jdbc.meta.MappingInfoNotFoundException: The join specification for
            "com_daffodil_activityscheduler.bdo.Attachment.workProduct" using mapping
            type "one-one" is not valid: no table named "null" was
            found.[com_daffodil_activityscheduler.bdo.Attachment.workProduct]
            at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:132)
            at kodo.jdbc.meta.Mappings.invalidForeignKey(Mappings.java:404)
            at kodo.jdbc.meta.Mappings.getForeignKey(Mappings.java:286)
            at
            kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapping.java:130)
            at
            kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)
            >>
            >>
            >>
            The Scenerio is

            abstract public class WorkProduct {

            private String name;
            private String description;

            public java.util.Collection attachments;
            }

            public class Dependent {

            public RequirementWorkProduct parentRequirement;
            public RequirementWorkProduct childRequirement;
            }


            abstract public class RequirementWorkProduct extends WorkProduct {


            public java.util.Collection dependents;
            public java.util.Collection dependencies;
            }

            public class Feature extends RequirementWorkProduct {
            ...fields are not shown
            }

            public class Attachment {

            private String detail;
            private String fileToAttach;

            public WorkProduct workProduct;
            }

            The JDO metadata for WorkProduct is

            <jdo>
            <package name="com_daffodil_activityscheduler.bdo">

            <class name ="WorkProduct">
            <extension vendor-name="kodo" key="jdbc-class-map-name"
            value="horizontal"/>
            <field name="name"/>
            <field name="description"/>
            <field name="attachments" >
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Attachment">
            <extension vendor-name="kodo" key="inverse-owner"
            value="workProduct"/>
            <extension vendor-name="kodo" key="element-dependent"
            value="true"/>
            </collection>
            </field>
            </class>
            </package>
            </jdo>

            The JDO metadata for Dependent

            <jdo>
            <package name="com_daffodil_activityscheduler.bdo">

            <class name ="Dependent">
            <field name="parentRequirement">
            <extension vendor-name="kodo" key="fetch-group"
            value="dependent.parentRequirement"/>
            </field>
            <field name="childRequirement">
            <extension vendor-name="kodo" key="fetch-group"
            value="dependent.childRequirement"/>
            </field>
            </class>
            </package>
            </jdo>

            The JDO metadata for RequirementWorkProduct is

            <jdo>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name ="RequirementWorkProduct"
            persistence-capable-superclass="WorkProduct">
            <extension vendor-name="kodo" key="jdbc-class-map-name"
            value="horizontal"/>
            <field name="dependents">
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Dependent">
            <extension vendor-name="kodo" key="fetch-group"
            value="parentRequirement.dependents"/>
            <extension vendor-name="kodo" key="inverse-owner"
            value="parentRequirement"/>
            <extension vendor-name="kodo" key="element-dependent"
            value="true"/>
            </collection>
            </field>
            <field name="dependencies">
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Dependent">
            <extension vendor-name="kodo" key="fetch-group"
            value="childRequirement.dependencies"/>
            <extension vendor-name="kodo" key="inverse-owner"
            value="childRequirement"/>
            <extension vendor-name="kodo" key="element-dependent"
            value="true"/>
            </collection>
            </field>
            </class>
            </package>
            </jdo>

            The JDO metadata for Feature is

            <jdo>
            <package name="com_daffodil_activityscheduler.bdo">

            <class name ="Feature"
            persistence-capable-superclass="RequirementWorkProduct">
            <extension vendor-name="kodo" key="jdbc-class-map-name"
            value="base"/>
            <extension vendor-name="kodo" key="detachable" value="true"/>

            ...field meta data
            </class>
            </package>
            </jdo>


            JDO metaData for Attachmet

            <jdo>
            <package name="com_daffodil_activityscheduler.bdo">

            <class name ="Attachment">
            <extension vendor-name="kodo" key="detachable" value="true"/>
            <field name="detail">
            <extension vendor-name="daffodil" key="display-name" value="Detail"
            />
            <extension vendor-name="daffodil" key="display-width" value="100" />
            </field>
            <field name="fileToAttach">
            <extension vendor-name="daffodil" key="display-name"
            value="FileToAttach" />
            <extension vendor-name="daffodil" key="display-width" value="100" />
            </field>
            <field name="workProduct">
            <extension vendor-name="kodo" key="fetch-group"
            value="attachment.workProduct"/>
            </field>
            </class>
            </package>
            </jdo>


            The mapping file for WorkProduct is

            <mapping>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name="WorkProduct">
                      <jdbc-class-map type="horizontal"/>
                 </class>
            </package>
            </mapping>

            The mapping for Dependent is

            <mapping>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name ="Dependent">
            <jdbc-class-map type="base" pk-column= "DependentId"
            table="Dependent"/>
            <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
            <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
            <field name="parentRequirement">
            <jdbc-field-map type="one-one"
            column.WORKPRODUCTID="PARENTREQUIREMENTID"/>
            </field>
            <field name="childRequirement">
            <jdbc-field-map type="one-one"
            column.WORKPRODUCTID="CHILDREQUIREMENTID"/>
            </field>
            </class>
            </package>
            </mapping>

            The mapping file for RequirementWorkProduct is

            <mapping>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name="RequirementWorkProduct">
                      <jdbc-class-map type="horizontal"/>
                 </class>
            </package>
            </mapping>


            The mapping file for Feature is
            <mapping>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name ="Feature"
            persistence-capable-superclass="RequirementWorkProduct">
            <jdbc-class-map type="base" pk-column= "WorkProductId"
            table="Feature"/>
            <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
            <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
            <field name="com_daffodil_activityscheduler.bdo.WorkProduct.name">
            <jdbc-field-map type="value" column="NAME" />
            </field>
            <field
            name="com_daffodil_activityscheduler.bdo.WorkProduct.description">
            <jdbc-field-map type="value" column="DESCRIPTION" />
            </field>
            <field
            name="com_daffodil_activityscheduler.bdo.WorkProduct.attachments">
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Attachment">
            <jdbc-field-map type="one-many"
            ref-column.WorkProductId="WorkProductId" table="ATTACHMENT"/>
            </collection>
            </field>
            <field name="RequirementWorkProduct.dependents">
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Dependent">
            <jdbc-field-map type="one-many"
            ref-column.WorkProductId="ParentWorkProductId" table="DEPENDENT"/>
            </collection>
            </field>
            <field name="RequirementWorkProduct.dependencies">
            <collection
            element-type="com_daffodil_activityscheduler.bdo.Dependent">
            <jdbc-field-map type="one-many"
            ref-column.WorkProductId="ChildWorkProductId" table="DEPENDENT"/>
            </collection>
            </field>
            </class>
            </package>
            </mapping>

            The mapping for Attachment

            <mapping>
            <package name="com_daffodil_activityscheduler.bdo">
            <class name ="Attachment">
            <jdbc-class-map type="base" pk-column= "AttachementId"
            table="Attachment"/>
            <jdbc-version-ind type="version-number" column="JDOLOCKX"/>
            <jdbc-class-ind type="in-class-name" column="JDOCLASSX"/>
            <field name="detail">
            <jdbc-field-map type="value" column="DETAIL" />
            </field>
            <field name="fileToAttach">
            <jdbc-field-map type="value" column="FILETOATTACH" />
            </field>
            <field name="workProduct">
            <jdbc-field-map type="one-one"
            column.WORKPRODUCTID="WORKPRODUCTID"/>
            </field>
            </class>
            </package>
            </mapping>


            The fileds in Feature table are
            workProductId (Pk column)
            name
            description
            notes
            ....


            The fields in Dependent table are

            dependentId (Pk column)
            parentWorkProductId
            childWorkProductId

            The fileds in Attachment table are

            attachementId (pk column)
            workProductId
            detail
            fileToAttach

            Every table has version indicator and class indicator fields.














            --
            Steve Kim
            skim@solarmetric.com
            SolarMetric Inc.
            http://www.solarmetric.com
            • 3. Re: Horizontal mapping with superclass having a collection
              3004
              There is no efficient way to form a relation to any object whose table is
              unknown. So if you want all your base classes to be horizontal, then relations
              to those base classes will not be efficient. Instead of one-one you must use
              pc, and instead of one-many or many-many you must use pc-collection. The only
              way to get more efficient mappings is to not form relations to the base classes
              (subclasses with tables only), or to not use horizontal base class mappings.