Creating and Editing Recursive Relationships

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to Working with Relationships

A recursive relationship associates an object with itself; the object is both the parent and child. For example, you can have an employee who manages many employees and each employee is managed by one employee. The employee entity has a recursive relationship to itself.

If you have a recursive relationship, you must assign rolenames to the relationship. Use the Recursive Relationship dialog to specify rolenames for a foreign key that is inherited more than once within the same entity. For example, if a recursive relationship is created where one entity is designated as both the parent and child entity, then the primary key is propagated within the entity. ER/Studio Data Architect automatically opens the Recursive Relationship dialog box when it detects overlapping foreign keys in an entity.

The steps for adding recursive relationships are slightly different from adding regular relationships; however, you can for edit and delete recursive relationships in the same manner as for regular relationships.


  1. Choose Insert > Insert Relationship, and then select a non-identifying relationship type.
  2. On the Data Model Window, click the object to which you want to apply the recursive relationship, and then click it again.
  3. Complete the Recursive Relationship or Recursive Relationship for Multiple Keys dialog box, and then click OK.
  4. Right click anywhere on the Data Model to revert to the Selection tool.

Notes

  • If you have a recursive relationship, the Recursive Relationship editor appears where you must assign a rolename to the primary key or to at least one attribute of the primary key. The rolename cannot be the same as the attribute or column name. In order for the foreign key to appear in the child, it must be assigned a rolename so it can be differentiated it from the native key.
  • If you have a recursive relationship where multiple foreign keys that are inherited more than once within the same entity, the Recursive Relationship for Multiple Keys dialog display where you specify rolenames for each foreign keys. For example, if a recursive relationship is created, where one entity is designated as both the parent and child entity, then the primary keys are propagated within the entity.
  • Edit the rolenames associated with the relationship by right-clicking the relationship in the Data Model Window, and then selecting Edit Rolenames.
  • Navigate between the parent and child object by right-clicking the object and then selecting Navigate to Parent or Navigate to Child from the shortcut menu.

See Also