Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.5
  Go To Table Of Contents
 Search
 PDFComments
Comments


@Convert

Use @Convert to specify that a named converter should be used with the corresponding mapped attribute.


Annotation Elements

Table 2-14 describes this annotation's elements.

Table 2-14 @Convert Annotation Elements

Annotation Element Description Default

value

(Optional) The String name for your converter

none



Usage

The @Convert has the following reserved names:


Examples

Example 2-31 shows how to use the @Convert annotation to define the gender field.

Example 2-31 Using the @Convert Annotation

@Entity
 @Table(name="EMPLOYEE")
 @Converter(
     name="genderConverter",
         converterClass=org.myorg.converters.GenderConverter.class
 )
 public class Employee implements Serializable{
     ...
     @Basic
     @Convert("genderConverter")
     public String getGender() {
         return gender;
     }
     ...
 }


See Also

For more information, see: