Using Array Table

In a one-to-many relationship, a collection is used for handling the multiple objects such that it is simpler to retrieve each object from the collection one by one. Visual Paradigm promotes the idea of Array Table which allows users to retrieve objects in the form of primitive array, instead of a collection when handling a data column with cardinality of many. Visual Paradigm allows you to create an array table in the entity and define an array type in the classes.

Converting an Entity to an Array Table

You can create an Array Table for the Entity with a column containing more than one instance of data.

  1. Locate the "many" side of an one-to-many relationship. In the following example, the phone book has a contact entry for each contact person. Each contact person may have more than one phone numbers. A one-to-many relationship between contact entry and contact phone is established.
    Entities with One-to-many relationship
    Entities with One-to-many relationship
  2. Right-click on the entity for the data column with cardinality of many, select Convert to Array Table from the popup menu.
    Convert to Array Table
    Convert to Array Table
  3. A warning message will be displayed, showing that the listed constraints are not satisfied for converting to array table. Click Yes to let Visual Paradigm to resolve the constraints automatically. Click No to cancel the conversion to array table.
  4. The conversion to Array Table is completed and the entity for the data column is stereotyped as <<Array Table>>.
    Array Table formed
    Array Table formed

Defining an Array Type for Attribute in Class

A class with an attribute of array type modifier means that the attribute may contain more than one data; thus it implies the idea of Array Table. You can define the array type for the attribute in one of the two ways:

Inline Editing

Double click on an attribute to edit it inline. Then, edit its type by appending the [] sign, which indicates that the attribute is an array.

Editing attribute inline
Editing attribute inline

Editing Type Modifier in Attribute Specification Window

Right click on an attribute and select Open Specification... from the popup menu. In the Attribute Specification window, choose [] as Type modifier.

Selecting [] as Type Modifier
Selecting [] as Type Modifier

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
14. Using Discriminator Column Table of Contents 16. Using Partial Table

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.OK