Chapter 8 O/R Mapping Modeling
Unlike one-to-one associations, just one foreign key will be generated for each one-to-many association, whatever its direction (bidirectional or unidirectional). The reference key navigates from the table generated from the entity class on multiple-valued side to the table generated from the entity class on single-valued side.
Given a one-to-many association defined between the class Customer and the class Order :
The generated foreign key will be the following:
PowerDesigner can generate a primary key of a parent table as part of the primary key of the child table.
To do so, you need to define the association as composition with the class on single-valued side containing the class on multiple-valued side:
The association is defined as composition association with the class Customer containing the class Order . The association looks like the following:
The generated tables and reference look like the following:
The primary key of the table Customer migrates into the table Order as part of its primary key.
For most O/R Mapping frameworks, one unidirectional one-to-many association will usually be mapped to a middle table and two references navigating from the middle table to the tables mapped by the two entity classes.
For more information, see the Defining one-to-many association mapping section.
Copyright (C) 2006. Sybase Inc. All rights reserved. |
![]() |