Chapter 8 O/R Mapping Modeling
Columns of primary keys should be mapped to persistent attributes. Like primary keys for tables, you need to set these persistent attributes as primary identifiers of entity classes. The mapped primary keys should be primary keys of primary tables.
There are three types of primary identifier mapping:
Primary identifier mapping is mandatory for entity classes.
To define simple primary identifier mapping:
To define composite primary identifier mapping:
Column(s) of primary keys can be mapped to association. They are migrated from primary keys of other tables.
For more information, see the One-to-many association transformation section.
To define component primary identifier mapping:
Attributes of value type classes are mapped to columns, which are embedded in primary tables mapped by other entity classes. So you have to add primary tables of the containing classes as value type classes' mapping sources. If the value type class is used in more than one entity class, you should map each of its persistent attributes to multiple columns of tables of these classes.
For example, Value type class Address is used as attribute type for two classes, Product and Customer .
The attributes of the Value type class Address can be mapped to columns of two tables, Company table and Customer table.
The mapping is easier to visualize in the Mapping Editor.
Copyright (C) 2006. Sybase Inc. All rights reserved. |
![]() |