Managing Multiplicity for Complex Persistent Data Types

If you define a multiplicity on a class attribute with a complex data type, the generation will reflect this multiplicity.

In the following example, attribute address in class Customer has a complex data type based on class Address.



You also define the multiplicity 0..2 for attribute address:



Generating as Persistent Class

When the Persistent check box is selected for the attribute and the class generation is also set to Persistent, then the attribute multiplicity becomes a cardinality on the relationship between entities after OOM to CDM generation.



Generating as Embedded Class

When the Persistent check box is selected for the attribute and the class generation is set to Embedded, all the attributes of the class used as data type are embedded into the entity containing the attribute with complex data type. Attributes are generated as many times as required by multiplicity, provided multiplicity indicates a fixed value.

In the following example, attribute multiplicity is 0..2, so attributes will be embedded twice:



Embedded generation of complex data types is not possible when multiplicity is undefined (0..n).