1. Home
  2. Docs
  3. Chapter 14. Database Design & Engineering
  4. 2. Database Designer’s Guide
  5. Using Array table

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
  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
  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

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 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