Defining Primary Keys Complete Walkthrough of the Adapter Configuration Wizard

9-14 Oracle Fusion Middleware Users Guide for Technology Adapters between two tables, or click Remove Relationship to remove it. To rename a relationship, click Rename Relationship. Figure 9–12 The Adapter Configuration Wizard: Relationships Page Note the following regarding creating relationships: ■ If foreign key constraints between tables already exist on the database, then two relationships are created automatically when you import the tables, a one-to-one 1:1 from the source table the table containing the foreign key constraints to the target table, and a one-to-many 1:M from the target table to the source table. ■ As Figure 9–12 shows, you see only the relationships that are reachable from the root database table. If, after removing a relationship, other relationships are no longer reachable from the root table, then they are not shown in the Relationships window. Consider the following set of relationships: A --1:1-- B --1:1-- C --1:M-- D --1:1-- E --1:M-- F 1 2 3 4 5 If you remove relationship 3, then you see only: A --1:1-- B B --1:1-- C If you remove relationship 2, then you see only: A --1:1-- B If you remove relationship 1, you no longer see any relationships. Figure 9–13 shows where you can create a new relationship. Oracle JCA Adapter for Database 9-15 Figure 9–13 The Create Relationship Dialog To create a new relationship: 1. Select the parent and child tables. 2. Select the mapping type one-to-many, one-to-one, or one-to-one with the foreign key on the child table. 3. Associate the foreign key fields to the primary key fields. 4. Optionally name the relationship a default name is generated.

9.2.7.1 What Happens When Relationships Are Created or Removed

When tables are initially imported into the Adapter Configuration Wizard, a TopLink direct-to-field mapping corresponding to each field in the database is created. Consider the schemas shown in Figure 9–14 and Figure 9–15 : Figure 9–14 EMPLOYEE Schema Figure 9–15 ADDRESS Schema Immediately after importing these two tables, the following mappings in the Employee descriptor are created: Employee: Note: Only tables that are reachable from the root table can be selected as a parent.