Hitachi

uCosminexus Application Server Compatibility Guide


9.6.1 Relationship types

A relationship consists of a relation and a direction. The possible relations are OneToOne, ManyToOne, OneToMany, and ManyToMany. Furthermore, the possible directions of each relation are unidirectional and bi-directional. The relations and directions are combined to form the following seven types of relationship:

This section describes relationships using the employees and departments of a company as an example. The relation between the employees and departments is as follows:

This example expresses the bi-directional ManyToOne/ OneToMany relationship of entities. In this case, Many stands for the employees and One stands for the department. The following figure shows the relation between the employee entity and the department entity.

Figure 9‒4: Relation between the employee entity and the department entity

[Figure]

Note that in an entity, you can specify settings to propagate the operations to the relation destination entity. These settings are called cascade. When you perform an operation for an entity and if cascade is specified, similar operations are automatically executed even in the entities that have a relationship with the operated entity. If cascade is used, the user can save the effort of performing operations for the relation destination entity.