O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required