Annotation Type Converter
-
@Target(TYPE) @Retention(RUNTIME) public @interface Converter
Specifies that the annotated class is a converter and defines its scope. A converter class must be annotated with theConverter
annotation or defined in the object/relational mapping descriptor as a converter.If the
autoApply
element is specified astrue
, the persistence provider must automatically apply the converter to all mapped attributes of the specified target type for all entities in the persistence unit except for attributes for which conversion is overridden by means of theConvert
annotation (or XML equivalent).In determining whether a converter is applicable to an attribute, the provider must treat primitive types and wrapper types as equivalent.
Note that Id attributes, version attributes, relationship attributes, and attributes explicitly annotated as
Enumerated
orTemporal
(or designated as such via XML) will not be converted.Note that if
autoApply
istrue
, theConvert
annotation may be used to override or disable auto-apply conversion on a per-attribute basis.If
autoApply
isfalse
, only those attributes of the target type for which theConvert
annotation (or corresponding XML element) has been specified will be converted.If there is more than one converter defined for the same target type, the
Convert
annotation should be used to explicitly specify which converter to use.- See Also:
AttributeConverter
,Convert
- Since:
- 2.1
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
autoApply
-