Have an entity relationship defined as one-to-one and optional on both ends of the relationship between entity A and entity B. When the model is transformed/implemented, the process placed the Foreign Key (FK), RI Constraints, and FK Index on table A, but wanted the FK and related objects on table B. How to change this?
It is noted that the relevant documentation page Implement Relationship Dialog states the location of the FK is arbitrary i.e. "If the optionality is the same for both entity types in a one-to-one relationship, the table to contain the foreign key is arbitrary."
Release : 8.6
Component : CA Gen Workstation Toolset
If the implementation of the one-to-one optional relationship between Entity A and Entity B has placed the Foreign Key (FK) and related objects on table A and it is desired to have the FK on table B, perform the following steps:
1. From within the Gen Toolset for the model involved, go to the Data Structure List (DSL)
2. On table A, using the ctrl key to select multiple objects at the same time, highlight the FK, the RI Constraint and (if it exists) any FK index including its columns for table B. Delete that selected group of objects.
3. Highlight table A (at the table level) and choose 'Edit > Implement Relationship...' selecting the relationship to table B. Now, the FK and its related objects will be created on table B.
The Gen sample model can be used to illustrate this behaviour.
Entity EMPLOYEE has a one-one relationship with entity DIVISION and it is optional in both directions.
After a normal full Transformation the EMPLOYEE table has the Foreign key column and RI Constraint for the DIVISION table.
In the Data Structure List under table EMPLOYEE delete the Foreign Key and RI Constraint for DIVISION.
Manually implement the relationship back by selecting the EMPLOYEE table and use 'Edit > Implement Relationship...' for the relationship to DIVISION.
The Foreign Key and RI Constraint for the EMPLOYEE table will then be created on the DIVISION table.