Defining relations between entities

Entities are one of the key concepts of a model. However, entities do not live in isolation; they are related to other entities. We can distinguish between different types of relations.

Owns or contains

Value objects can never exist alone. They only become a meaning in conjunction with an entity. An entity can own or contain zero to many value objects. In the case of the previous Customer entity, the value object Name is owned or contained by the Customer entity. This relation is indicted by an arrow pointing from the entity to the value object, as shown in the following screenshot. Near to the arrow head, we find the name of the value object type property in the entity.

Note that there is no arrow pointing back ...

Get NHibernate 3 Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.