Declarative Objectivity (DO) Language : Attribute Structures : Embedded-Object Attributes
Embedded-Object Attributes
Embedded-object attributes are attributes that can directly hold instances of an embeddable schema class that represent complex values.
Embedded-Object Values
Logical Type
Quick Look
Objects of an embeddable class
corporateAddress: Object {
  Class: FleetData.Address
For general syntax information, see About Attribute Structures.
For details about embedded-object attributes, see About Embedded-Object Attributes, below.
For examples of literal embedded-object values, see Object Structures.
Specifying the Attribute Type
An embedded-object data attribute has the following logical type:
Logical Type
Instances of an embeddable schema class, where each instance is embedded directly in an enclosing object.
Specifying Type Characteristics
An embedded-object data attribute uses the following setting to specify detailed type characteristics:
The class of the objects to be embedded. Must be an embeddable schema class.
About Embedded-Object Attributes
An embedded-object attribute is an attribute whose values are objects of an embeddable class. You specify the embeddable class using the Class: setting of the attribute structure.
Embedding an object causes the values of its attributes to be stored directly among those of another object. For example, assume that Customer is a schema class with several attributes, including an embedded-object attribute whose Class: setting specifies the embeddable class Address. When a new Customer object is created, it has space allocated for the attributes of an Address object, in addition to the space allocated for its other attributes. When values are assigned to the Address’s attributes, they are stored among the values of the Customer’s other attributes.
A embedded-object attribute enforces ownership semantics:
Creating the embedding object automatically creates the embedded object.
Deleting the embedding object automatically deletes the embedded object.
Note:Any embeddable class can be specified as the type of an embedded attribute, with one restriction: an embeddable class cannot embed itself either directly or indirectly. For example, an embeddable class called Address cannot have an embedded attribute of class Address, nor can it embed any other class that has an embedded attribute of class Address.