5.1.13. component, dynamic-component
The <component> element maps properties of a child object to columns of the table of a parent class. Components may, in turn, declare their own properties, components or collections. See "Components" below.
<component
name="propertyName"
class="className"
insert="true|false"
update="true|false"
access="field|property|ClassName"
lazy="true|false"
optimistic-lock="true|false"
unique="true|false"
node="element-name|."
>
<property ...../>
<many-to-one .... />
........
</component>
name: The name of the property.
class (optional - defaults to the property type determined by reflection): The name of the component (child) class.
insert: Do the mapped columns appear in SQL INSERT s?
update: Do the mapped columns appear in SQL UPDATE s?
access (optional - defaults to property): The strategy Hibernate should use for accessing the property value.
lazy (optional - defaults to false): Specifies that this component should be fetched lazily when the instance variable is first accessed (requires build-time bytecode instrumentation).
optimistic-lock (optional - defaults to true): Specifies that updates to this component do or do not require acquisition of the optimistic lock. In other words, determines if a version increment should occur when this property is dirty.
unique (optional - defaults to false): Specifies that a unique constraint exists upon all mapped columns of the component.
The child <property> tags map properties of the child class to table columns.
The <component> element allows a <parent> subelement that maps a property of the component class as a reference back to the containing entity.
The <dynamic-component> element allows a Map to be mapped as a component, where the property names refer to keys of the map, see Section 8.5, “Dynamic components”.