Managing Complex Data Type Persistence

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 Attaching a Classifier to a Data Type or a Return Type.

When you apply a persistent complex data type to a class attribute or a domain, you can define the following different generation options:

Generating as Persistent Class

In the Detail page of the property sheet of an attribute using a complex data type, you have to select:

  • The Persistent check box

  • Persistent in the Class Generation list

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.

Example

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.

Generating as Embedded Class

In the Detail page of the property sheet of an attribute using a complex data type, you have to select:

  • The Persistent check box

  • Embedded in the Class Generation list

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.

Example

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.