6.2.2. Collection elements
Collections can contain almost any other Hibernate type, including: basic types, custom types, components and references to other entities. This is an important distinction. An object in a collection might be handled with "value" semantics (its life cycle fully depends on the collection owner), or it might be a reference to another entity with its own life cycle. In the latter case, only the "link" between the two objects is considered to be a state held by the collection.
The contained type is referred to as the collection element type. Collection elements are mapped by
<element>
or <composite-element>
, or in the case of entity references, with <one-to-many>
or <many-to-many>
. The first two map elements with value semantics, the next two are used to map entity associations.