Previous Topic: How to Create an Indirect AssociationNext Topic: Container Classes


Indirect Association Example

This example shows you the steps you would follow if you are an administrator that wants to create an indirect association between an Employees class, and a Departments class using a membership table.

This example uses an example schema, HR, and an example membership table, Membership. The membership table columns Account_Id and Dept_id contain the association mappings that identify the individual employees and departments that are related, as shown in the following example:

Indirect Relationship

To identify individual employees and departments that are related, create an indirect association between them.

Note: This example assumes that you have already set up a JDBC data source, and created and mapped an account class named Employees.

Follow these steps:

  1. Click the Classes node.

    The Mapped Classes dialog appears.

  2. Click Add, then specify a name for your class, for example, Departments.

    Connector Xpress adds a node named Department to the mapping tree.

  3. Click the Departments node in the mapping tree.

    The Map Class dialog appears.

  4. Specify a name and description for your class.

    Note: These fields are for descriptive purposes only.

  5. Select the schema and table you want to map, for example, HR and Departments.
  6. In the mapping tree, click the Attributes node.

    The Map Attributes dialog appears.

  7. In the Name column, map the account naming attribute to the objectname attribute.
  8. Click the Associations node under the Employees node.

    The Class Associations dialog appears.

  9. Create an indirect association with the Departments class.

    Connector Xpress adds a node named with Departments under the Associations node for the Employees class in the mapping tree.

  10. In the Mapping tree, click the with Departments node under the Associations node.

    The Indirect Association dialog appears.

  11. Specify the schema that contains the classes you want to map, for example, HR.
  12. In the Membership Table list, select the membership table, Membership.

    This table specifies the association mappings that identify the individual employees and departments that are related.

  13. In the Employees Attribute list, select the Employees class naming attribute.
  14. In the Membership Table Columns list, select AccountID and DeptID respectively.

    The result is the following:

    Note: Connector Xpress selects the naming class attributes by default in the Employees and Departments Attributes list.

  15. In the Employees Attribute and Departments Attributes fields, type member and memberof respectively.

    Note: In this example, because the Employees and Department classes do not have a memberOf or member attribute, create a virtual member and memberOf attributes.

    The virtual attributes you create describe the association between the Employee class and Department class.

    These virtual attributes are a virtual representation of the association between the employee class and department classes naming attributes, and the membership table columns you mapped in step 11. The connector uses these virtual attributes to find the employees in a department, and the departments an employee belongs to.

    Connector Xpress automatically does the following:

  16. Click Project, Save.

    Connector Xpress creates the indirect association between the Employees and Departments class you have mapped.

More Information:

How to Define Group Membership

Indirect Associations

How to Create an Indirect Association