Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Foreign Key Pairs

In a one-to-many EIS mapping, you relate a source object attribute to a target object attribute by specifying one or more pairs of source and target object fields.

In a one-to-many EIS mapping with key on source (see "EIS One-to-Many Mappings With Key on Source") using XML records, TopLink puts the target XML field value into the source object's record as a simple value. By default, these values are not grouped, as Example 63-1 shows.

Example 63-1 Source Object XML Record without Grouping

    <employee>
        <name>Jane</name>
        <project-id>3</project-id>
        <project-id>4</project-id>
    </employee>

If you specify more than one source and target XML field pair, you must specify a grouping element, as Example 63-2 shows.

Example 63-2 Source Object XML Record with Grouping

    <employee>
        <name>Jane</name>
        <project>
            <project-id>3</project-id>
            <project-name>Project 3</project-name>
        </project>
        <project>
            <project-id>4</project-id>
            <project-name>Project 4</project-name>
        </project>
    </employee>

In a one-to-one EIS mapping with key on target (see "EIS One-to-Many Mappings With Key on Target") using XML records, TopLink uses the source XML field value in the selection interaction to acquire the appropriate instances of target object.

## Using TopLink Workbench

To specify the source and target XML field pairs for a one-to-many EIS mapping, use this procedure:

Use the following information to complete the Foreign Keys fields on the General tab:

Field | Description
--- | ---
Foreign Keys Located On Target | Select if you are creating a one-to-many EIS mapping with key on target (see "EIS One-to-Many Mappings With Key on Target").
Foreign Keys Located On Source | Select if you are creating a one-to-many EIS mapping with key on source (see "EIS One-to-Many Mappings With Key on Source").
Grouping Element | Specify the element in which foreign key pairs are grouped in the source object's EIS record. If you specify only one pair of source and target XML fields, this is optional. If you specify more than one pair of source and target XML fields, this is required.
Field Pairs | Click Add to add a pair of source and target XML fields. Specify Field Pair dialog box opens. Click Browse to add a foreign key for the Source XPath and Target XPath fields.