An indirect association occurs when there is a third entity defines the association between any two classes of object. For example, an intermediate table that binds two other database tables together.
In an indirect association, the association is stored as an independent entity rather than as a property on one of the objects.
For example, there is an indirect association between an account object and a group object if there is an intermediate table, such as a membership table, that identifies the associations between individual accounts and groups.
In a direct association, objects have an attribute that points directly to the other object. However in an indirect association, both of the related objects have attributes that point not to each other, but to the membership table.
Membership tables define the members of each group. They contain the association mappings that identify the individual accounts and groups that are related, for example, the groups an account belongs to, and a list of accounts in each group. In a membership table, associations between objects are stored in a many-to-many mapping table.
Membership tables let you specify a separate lookup table for associations between account and group objects and map the relevant attributes.
To define an indirect association, you specify the membership table that contains references to both of the related objects.
When you create an indirect association between two objects, Connector Xpress automatically creates the reverse association, that is; indirect associations are by definition bi-directional.
Note: You can only create indirect associations for JDBC mappings.
Example: Indirect Association
The following diagram shows the indirect association that has been mapped between the employee and department classes using a membership table. The following is an example schema and database.
The following are the three tables in the database:
The virtual attribute memberOf contains Group IDs, that is the departments the employee is a member of.
The virtual attribute members contains Account IDs, that is,the list of employees in the department.
Copyright © 2013 CA.
All rights reserved.
|
|