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


Use @Customizer to specify a class that implements org.eclipse.persistence.config.DescriptorCustomizer and is to run against an entity's class descriptor after all metadata processing has been completed.

Annotation Elements

Table 2-18 describes this annotation's elements.

Table 2-18 @Customizer Annotation Elements

Annotation Element Description Default


(Required) The name of the descriptor customizer to apply to the entity's descriptor.


Use this annotation to customize or extend the mapping metadata through the EclipseLink native API. With @Customizer, you can access additional EclipseLink functionality and configurations.

You can specify @Customizer on an Entity, MappedSuperclass, or Embeddable class.


A @Customizer is not inherited from its parent classes.


Example 2-36 show how to use the @Customizer annotation with the following DescriptorCustomer:

public class MyCustomizer implements DescriptorCustomizer {
  public void customize(ClassDescriptor descriptor) {
    DirectToFieldMapping genderMapping = (DirectToFieldMapping)descriptor.getMappingForAttributeName("gender");
    ObjectTypeConverter converter = new ObjectTypeConverter();
    convert.addConversionValue("M", Gender.MALE);
    convert.addConversionValue("F", Gender.FEMALE);

Example 2-36 Using @Customizer Annotation

 public class Employee implements Serializable {

Example 2-37 show how to use the <customizer> element in the eclipselink-orm.xml file.

Example 2-37 Using <customizer> XML

<entity class="Employee">
  <table name="EMPLOYEE"/>
  <customizer class="mypackage.MyCustomizer"/>

See Also

For more information, see: