Annotation Interface AttributeOverride


Used to override the mapping of a Basic (whether explicit or default) property or field or Id property or field.

May be applied to an entity that extends a mapped superclass or to an embedded field or property to override a basic mapping or id mapping defined by the mapped superclass or embeddable class (or embeddable class of one of its attributes).

May be applied to an element collection containing instances of an embeddable class or to a map collection whose key and/or value is an embeddable class. When AttributeOverride is applied to a map, "key." or "value." must be used to prefix the name of the attribute that is being overridden in order to specify it as part of the map key or map value.

To override mappings at multiple levels of embedding, a dot (.) notation form must be used in the name element to indicate an attribute within an embedded attribute. The value of each identifier used with the dot notation is the name of the respective embedded field or property.

If AttributeOverride is not specified, the column is mapped the same as in the original mapping.

Example 1:

Example 2:

Example 3:

Since:
1.0
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    (Required) The column that is being mapped to the persistent attribute.
    (Required) The name of the property whose mapping is being overridden if property-based access is being used, or the name of the field if field-based access is used.
  • Element Details

    • name

      String name
      (Required) The name of the property whose mapping is being overridden if property-based access is being used, or the name of the field if field-based access is used.
    • column

      Column column
      (Required) The column that is being mapped to the persistent attribute. The mapping type will remain the same as is defined in the embeddable class or mapped superclass.