javax.persistence

## Interface AttributeConverter<X,Y>

Type Parameters:
  `X` - the type of the entity attribute
  `Y` - the type of the database column

    public interface AttributeConverter<X,Y>

A class that implements this interface can be used to convert entity attribute state into database column representation and back again. Note that the X and Y types may be the same Java type.

### Method Summary

All Methods Instance Methods Abstract Methods
`Y` `convertToDatabaseColumn(X attribute)` Converts the value stored in the entity attribute into the data representation to be stored in the database.
`X` `convertToEntityAttribute(Y dbData)` Converts the data stored in the database column into the value to be stored in the entity attribute.

### Method Detail

#### convertToDatabaseColumn

    Y convertToDatabaseColumn(X attribute)

Converts the value stored in the entity attribute into the data representation to be stored in the database.

Parameters:
  `attribute` - the entity attribute value to be converted
Returns:
  the converted data to be stored in the database column

#### convertToEntityAttribute

    X convertToEntityAttribute(Y dbData)

Converts the data stored in the database column into the value to be stored in the entity attribute. Note that it is the responsibility of the converter writer to specify the correct `dbData` type for the corresponding column for use by the JDBC driver: i.e., persistence providers are not expected to do such type conversion.

Parameters:
  `dbData` - the data from the database column to be converted
Returns:
  the converted value to be stored in the entity attribute