Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


@Property

Use @Property to specify a single user-defined property on a mapped attribute or its get/set method. Use the @Properties annotation to wrap multiple properties.


Annotation Elements

Table 2-55 describes this annotation's elements.

Table 2-55 @Property Annotation Elements

Annotation Element Description Default

name

(Required) Name of the property


value

(Required) String representation of the property value, converted to an instance of valueType.


valueType

(Optional) Property value type, converted to valueType by ConversionManager. This must be a simple type that can be handled by the ConversionManager.

String



Usage

You can specify @Property on a mapped attribute (or its get/set method) within an Entity, MappedSuperclass, or Embeddable class. You can also specify this annotation on an Entity, MappedSuperclass, or Embeddable class.

Properties defined in MappedSuperclass are passed to all inheriting Entities and MappedSuperclasses. In case of a conflict, property values defined directly on a class always override values inherited from a class's parent.

When using an orm.xml mapping file, EclipseLink ignores @Property and @Properties annotations on mapped attributes; annotations on classes are merged with those specified i the orm.xml file, with the latter taking precedence in case of conflicts.


Examples

Example 2-114 shows how to use the @Property annotation within a @Transformation mapping. Example 2-115 shows how to use the <property> XML element within the orm.xml file.


See Also

For more information, see: