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 |
---|---|---|
|
(Required) Name of the property |
|
|
(Required) String representation of the property |
|
|
(Optional) Property value type, converted to valueType by |
|
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: