Specifies how the values of a field or property are converted to a basic type or a type that can be persisted by a persistence provider.
The Convert
annotation may be applied to any field or property and must be used in conjunction with the
Id
or Column
annotation (if not, a default value will be used).
The dot notation may also be used with map entries:
Convert a basic attribute
@Converter
public class BooleanToIntegerConverter
implements AttributeConverter<Boolean, Integer> { ... }
@Entity
public class Employee {
@Id
long id;
@Convert(converter = BooleanToIntegerConverter.class)
boolean fullTime;
}
- Since:
- 1.0.0
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass
<? extends AttributeConverter<?, ?>> Specifies the converter to be applied.
-
Element Details
-
value
Class<? extends AttributeConverter<?,?>> valueSpecifies the converter to be applied.- Returns:
- the converter class
-