Entering content frame

Function documentation Many-to-One Unidirectional Generic Relationships Locate the document in its SAP Library structure

Use

A many-to-one generic unidirectional relationship has a field of object type, interface type or non-persistence capable class type on the many-side of the relationship.

In the relational model, there is a generic persistent reference in the table that corresponds to the class on the many-side.

 

Example

The class example.jdo.Employee contains field refwith type example.jdo.SomeInterface. The field is mapped to the generic persistent reference that consists of columns REF1DISC and REF1 for the discriminator and the reference in table TMP_INTERFACE.

 

This graphic is explained in the accompanying text

 

The XML metadata has the following contents:

 

<jdo>

  <package name="example.jdo">

    <class name="Employee" identity-type="application" objectid-class="Employee$Id">

      <field name="empid" persistence-modifier="persistent" primary-key="true"/>

      <field name="ref" persistence-modifier="persistent"

        embedded="false" default-fetch-group="false"/>

    </class>

  </package>

</jdo>

 

<map version="1.0">

  <package name="example.jdo">

    <class name="Employee">

      <field name="empid">

        <column name="EMPID" table="TMP_INTERFACE"/>

      </field>

      <relationship-field name="ref" multiplicity="one">

        <discriminator>

          <column name="REF1DISC" table="TMP_INTERFACE"/>

        </discriminator>         

        <reference>

          <column name="REF1" table="TMP_INTERFACE"/>

        </reference>

      </relationship-field>

    </class>

  </package>

</map>

 

 

Leaving content frame