Chapter 12 Generating Other Models from an OOM


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 reference between tables after OOM to PDM 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 table containing the column created for 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).

Generating as abstract data type class

When both attribute and class generation are set to Persistent, and when the class used as data type is generated as an abstract data type, the class is generated as an abstract data type without taking into account the multiplicity of the generated attribute.

However, for those DBMS that support ARRAY and LIST for abstract data types, the generation of a class into an abstract data type can reflect the attribute multiplicity in the following way:

Multiplicity Generated as
0..n or 1..n Abstract data type with the LIST type (example: TABLE for Oracle)
1..2 or 0..10 Abstract data type with the ARRAY type (example: VARRAY for Oracle)
0..1 or 1..1 Abstract data type with the OBJECT type

 


Copyright (C) 2005. Sybase Inc. All rights reserved.