ER/Studio - Embarcadero Technologies Product Documentation
ER/Studio - Embarcadero Technologies Product Documentation ER/Studio - Embarcadero Technologies Product Documentation
USING ER/STUDIO > DEVELOPING THE LOGICAL MODEL • To modify the properties of a foreign key attribute, you must alter the corresponding primary key column in the originating parent table. • To preserve domain consistency, ER/Studio only lets you change the column name of foreign keys. To modify other properties of a foreign key column, you must alter the corresponding primary key column in the originating parent table. Create a Foreign Key/Relationship Foreign keys are created when you establish relationships between entities. The primary key of the parent object becomes the foreign key of the child object. Foreign keys are not displayed in the entity boxes in the Data Model Window when using Filtered IE (No FKs) but are displayed using all other notation types. For more information, see Working with Relationships. Specify FK Attribute Name and Datatype By default, the foreign keys inherit their names from the primary key of the parent object; however, you can choose to provide another name for the foreign key using the Logical Rolename. 1 Double-click the entity you want to change. 2 Click the foreign key in the attributes list and then click Edit. 3 Enter a Logical Rolename and then select Synchronize Column Rolename with Logical Rolename. 4 Click Save. The child now displays the logical rolename of the foreign key. Similarly, you can specify a different datatype for the foreign key. 1 Double-click the entity and from the Entity Editor, select the foreign key from the attributes list and then click Edit. 2 Select Edit Foreign Key Datatype and then make the necessary changes to the datatype. 3 Click Save. Working with Relationships Relationships help enforce business rules and assertions in a data model. Relationships determine how data are related between two entities and/or views. Relationships are implemented as foreign keys in the physical model. The properties of these foreign keys dictate how referential integrity is enforced between tables through constraints and triggers. In addition to standard relationships ER/Studio lets you create recursive relationships, those where an object is related to itself; duplicate relationships, where multiple relationships relate to the same objects; view relationships that relate entities or tables to views, and subtype clusters that associate multiple homogenous entities (subtypes) to a supertype entity. For more information on relationships, see the following topics: • Creating and Editing Relationships • Creating and Editing Recursive Relationships • Creating View Relationships • Creating Subtype Cluster Relationships EMBARCADERO TECHNOLOGIES > ER/STUDIO® 8.0.3 USER GUIDE 130
USING ER/STUDIO > DEVELOPING THE LOGICAL MODEL • Resolving Name Duplication in Parent and Child Entities (Unification) Creating and Editing Relationships 1 On the Data Model Explorer, click the Data Model tab. 2 Click Insert > Relationship and then click the type of relationship you want to insert. 3 On the Data Model Window, click the parent object and then click the child object. • The Duplicate Attribute Editor displays If both the parent and child objects have the same column or attribute names. Here you can resolve these conflicts by assigning rolenames to foreign keys. • The Recursive Relationship editor displays when you create a recursive relationship, which is a non-identifying relationship where the parent and child object are the same. Using this editor you can assign rolenames to any duplicate keys to differentiate the native and foreign key. For more information, see Creating and Editing Recursive Relationships. • The Duplicate Relationship editor displays when you draw a relationship that will result in multiple identifying and/or non-identifying relationships between two entities. Using this editor you can assign rolenames to any overlapping foreign keys; otherwise, ER/Studio unifies any overlapping Foreign Keys. • The Edit Rolenames dialog displays if overlapping foreign keys are detected when you are drawing a relationship. On the Edit RoleNames dialog you can specify rolenames for foreign keys that are inherited more than once. When a primary key is propagated to a child table, the name of the attribute is also propagated to the child table. A rolename lets you rename the attribute of the foreign key to avoid confusion and resolve the relationship conflict. 4 Repeat step 2 and step 3 and until you have created all necessary relationships. 5 To revert to the Selection tool, right-click anywhere on the Data Model Window. 6 On the Data Model Window, double-click the relationship 7 Complete the Relationship Editor and then click OK to exit the editor. The following describe options that require additional explanation. For general information that applies to the Relationship Editor, see Notes. • Parent Key: Lets you select and propagate an Alternate Key (logical model) or a Unique Index (physical model) to a child entity or table. Use this option if you do not want to propagate the primary key. If there are no alternate keys or unique indexes in the parent table the primary key will be used. • Logical Only: Logical model only. If selected, the relationship will not be implemented when generating a physical model, and will be ignored when comparing the logical model with a physical model. • Physical Only: Physical model only. If selected, the relationship will be ignored when comparing the physical model with a logical model. • Do Not Generate: Physical model only. If selected, the foreign key (FK) columns (if any) will be ignored when generating DDL, as in the Compare and Merge Utility. The FK constraint is not generated but the FK column is generated as a native column. To prevent the FK from being generated, edit the FK column in the Table Editor and select the Hide Key Attribute option. Use this option when relational integrity is enforced in the application rather than by an explicit foreign key in the RDBMS. • Not For Replication: If selected, updates to the parent will not be replicated to the child entity. This prevents any foreign key constraints from being applied when updating the child entity. EMBARCADERO TECHNOLOGIES > ER/STUDIO® 8.0.3 USER GUIDE 131
- Page 79 and 80: USING ER/STUDIO > COMMON TASKS Sync
- Page 81 and 82: USING ER/STUDIO > COMMON TASKS In c
- Page 83 and 84: USING ER/STUDIO > COMMON TASKS Adva
- Page 85 and 86: USING ER/STUDIO > COMMON TASKS Asso
- Page 87 and 88: USING ER/STUDIO > COMMON TASKS Comp
- Page 89 and 90: USING ER/STUDIO > COMMON TASKS Dime
- Page 91 and 92: USING ER/STUDIO > COMMON TASKS •
- Page 93 and 94: USING ER/STUDIO > COMMON TASKS See
- Page 95 and 96: USING ER/STUDIO > COMMON TASKS The
- Page 97 and 98: USING ER/STUDIO > COMMON TASKS The
- Page 99 and 100: USING ER/STUDIO > COMMON TASKS •
- Page 101 and 102: USING ER/STUDIO > COMMON TASKS 3 In
- Page 103 and 104: USING ER/STUDIO > COMMON TASKS Chan
- Page 105 and 106: USING ER/STUDIO > COMMON TASKS •
- Page 107 and 108: USING ER/STUDIO > COMMON TASKS Shap
- Page 109 and 110: USING ER/STUDIO > COMMON TASKS Addi
- Page 111 and 112: USING ER/STUDIO > DEVELOPING THE LO
- Page 113 and 114: USING ER/STUDIO > DEVELOPING THE LO
- Page 115 and 116: USING ER/STUDIO > DEVELOPING THE LO
- Page 117 and 118: USING ER/STUDIO > DEVELOPING THE LO
- Page 119 and 120: USING ER/STUDIO > DEVELOPING THE LO
- Page 121 and 122: USING ER/STUDIO > DEVELOPING THE LO
- Page 123 and 124: USING ER/STUDIO > DEVELOPING THE LO
- Page 125 and 126: USING ER/STUDIO > DEVELOPING THE LO
- Page 127 and 128: USING ER/STUDIO > DEVELOPING THE LO
- Page 129: USING ER/STUDIO > DEVELOPING THE LO
- Page 133 and 134: USING ER/STUDIO > DEVELOPING THE LO
- Page 135 and 136: USING ER/STUDIO > DEVELOPING THE LO
- Page 137 and 138: USING ER/STUDIO > DEVELOPING THE LO
- Page 139 and 140: USING ER/STUDIO > DEVELOPING THE LO
- Page 141 and 142: USING ER/STUDIO > DEVELOPING THE LO
- Page 143 and 144: USING ER/STUDIO > DEVELOPING THE PH
- Page 145 and 146: USING ER/STUDIO > DEVELOPING THE PH
- Page 147 and 148: USING ER/STUDIO > DEVELOPING THE PH
- Page 149 and 150: USING ER/STUDIO > DEVELOPING THE PH
- Page 151 and 152: USING ER/STUDIO > DEVELOPING THE PH
- Page 153 and 154: USING ER/STUDIO > DEVELOPING THE PH
- Page 155 and 156: USING ER/STUDIO > DEVELOPING THE PH
- Page 157 and 158: USING ER/STUDIO > DEVELOPING THE PH
- Page 159 and 160: USING ER/STUDIO > DEVELOPING THE PH
- Page 161 and 162: USING ER/STUDIO > DEVELOPING THE PH
- Page 163 and 164: USING ER/STUDIO > DEVELOPING THE PH
- Page 165 and 166: USING ER/STUDIO > DEVELOPING THE PH
- Page 167 and 168: USING ER/STUDIO > DEVELOPING THE PH
- Page 169 and 170: USING ER/STUDIO > DEVELOPING THE PH
- Page 171 and 172: USING ER/STUDIO > DEVELOPING THE PH
- Page 173 and 174: USING ER/STUDIO > DEVELOPING THE PH
- Page 175 and 176: USING ER/STUDIO > DEVELOPING THE PH
- Page 177 and 178: USING ER/STUDIO > DEVELOPING THE PH
- Page 179 and 180: USING ER/STUDIO > DEVELOPING THE PH
USING <strong>ER</strong>/STUDIO > DEVELOPING THE LOGICAL MODEL<br />
• To modify the properties of a foreign key attribute, you must alter the corresponding primary key column in the<br />
originating parent table.<br />
• To preserve domain consistency, <strong>ER</strong>/<strong>Studio</strong> only lets you change the column name of foreign keys. To modify<br />
other properties of a foreign key column, you must alter the corresponding primary key column in the originating<br />
parent table.<br />
Create a Foreign Key/Relationship<br />
Foreign keys are created when you establish relationships between entities. The primary key of the parent object<br />
becomes the foreign key of the child object. Foreign keys are not displayed in the entity boxes in the Data Model<br />
Window when using Filtered IE (No FKs) but are displayed using all other notation types. For more information, see<br />
Working with Relationships.<br />
Specify FK Attribute Name and Datatype<br />
By default, the foreign keys inherit their names from the primary key of the parent object; however, you can choose to<br />
provide another name for the foreign key using the Logical Rolename.<br />
1 Double-click the entity you want to change.<br />
2 Click the foreign key in the attributes list and then click Edit.<br />
3 Enter a Logical Rolename and then select Synchronize Column Rolename with Logical Rolename.<br />
4 Click Save.<br />
The child now displays the logical rolename of the foreign key.<br />
Similarly, you can specify a different datatype for the foreign key.<br />
1 Double-click the entity and from the Entity Editor, select the foreign key from the attributes list and then click<br />
Edit.<br />
2 Select Edit Foreign Key Datatype and then make the necessary changes to the datatype.<br />
3 Click Save.<br />
Working with Relationships<br />
Relationships help enforce business rules and assertions in a data model. Relationships determine how data are<br />
related between two entities and/or views. Relationships are implemented as foreign keys in the physical model. The<br />
properties of these foreign keys dictate how referential integrity is enforced between tables through constraints and<br />
triggers.<br />
In addition to standard relationships <strong>ER</strong>/<strong>Studio</strong> lets you create recursive relationships, those where an object is related<br />
to itself; duplicate relationships, where multiple relationships relate to the same objects; view relationships that relate<br />
entities or tables to views, and subtype clusters that associate multiple homogenous entities (subtypes) to a supertype<br />
entity.<br />
For more information on relationships, see the following topics:<br />
• Creating and Editing Relationships<br />
• Creating and Editing Recursive Relationships<br />
• Creating View Relationships<br />
• Creating Subtype Cluster Relationships<br />
EMBARCAD<strong>ER</strong>O TECHNOLOGIES > <strong>ER</strong>/STUDIO® 8.0.3 US<strong>ER</strong> GUIDE 130