Jump to: navigation, search

EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Default Conversions and Converters/Convert

Elug api package icon.png Key API {{{apis}}}

@Convert Annotation

How to Use the @Convert Annotation

The @Convert annotation specifies that a named converter should be used with the corresponding mapped attribute.

 @Target({METHOD, FIELD})
 public @interface Convert {
    String value() default "none";

The @Convert has the following reserved names:

  • serialized – places the org.eclipse.persistence.mappings.converters.SerializedObjectConverter on the associated mapping.
  • none – does not place a converter on the associated mapping.

This table lists attributes of the @Convert annotation.

Attributes of the @Convert Annotation

Attribute Description Default Required or Optional


Set this attribute to the String name for your converter.

"none" String


This example shows how to use the @Convert annotation to define the Employee field gender.

Usage of the @Convert Annotation

 public class Employee implements Serializable{
     public String getGender() {
         return gender;

Version: 2.1.0
Other versions...