Chapter 12 Generating Other Models from an OOM
In the following example, both classes are defined as persistent.
Class Customer contains an attribute address with a complex data type ADDRESS. This data type is based on the code of class Address.
For more information on how to use a class as a data type, see the "Attaching a classifier to a data type or a return type" section in the Building Structural Diagrams chapter.
When you apply a persistent complex data type to a class attribute or a domain, you can define the following different generation options:
In the Detail page of the property sheet of an attribute using a complex data type, you have to select:
After OOM to CDM generation, both classes become entities and a relationship is created between them. The class used as data type contains a new primary identifier attribute.
If you define the standard data type generation options in the Address/Customer example, the generated CDM is the following:
The new column Address_ID is the primary identifier in entity Address.
In the Detail page of the property sheet of an attribute using a complex data type, you have to select:
After OOM to CDM generation, all the attributes of the class used as data type are embedded into the entity containing the attribute with complex data type. These attributes are prefixed by the name of the attribute using the complex data type.
If you define the embedded data type generation options in the Address/Customer example, the generated CDM is the following:
All the attributes of class Address are embedded into entity Customer and prefixed by "address" which is the name of the attribute using Address as complex data type.
Copyright (C) 2005. Sybase Inc. All rights reserved. |