Interface AttributeConverter<X,Y>

Type Parameters:
X - the target type, that is, the type of the entity attribute
Y - a basic type representing the type of the database column

public interface AttributeConverter<X,Y>
Interface implemented by custom attribute converters. A converter is a class whose methods convert between:
  • the target type of the converter, an arbitrary Java type which may be used as the type of a persistent field or property, and
  • a basic type used as an intermediate step in mapping to the database representation.

A converted field or property is considered Basic, since, with the aid of the converter, its values can be represented as instances of a basic type.

A converter class must be annotated Converter or declared as a converter in the object/relational mapping descriptor. The value of autoApply determines if the converter is automatically applied to persistent fields and properties of the target type. The Convert annotation may be used to apply a converter which is declared autoApply=false, to explicitly disable conversion, or to resolve ambiguities when multiple converters would otherwise apply.

Note that the target type X and the converted basic type Y may be the same Java type.

See Also: