Loading
Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
Contents
 Search
Other Searches
 PDF
PDF
Comments
Comments


@ReadTransformer

Use @ReadTransformer with Transformation mappings to define the transformation of the database column values into attribute values (unless the mapping is write-only).


Annotation Elements

Table 2-59 describes this annotation's elements.

Table 2-59 @ReadTransformer Annotation Elements

Annotation Element Description Default

method

The mapped class must have a method with this name which returns a value to be assigned to the attribute (not assigns the value to the attribute).


transformerClass

User-defined class that implements the org.eclipse.persistence.mappings.transformers.AttributeTransformer interface.

The class will be instantiated, its buildAttributeValue will be used to create the value to be assigned to the attribute.

void.class



NoteNote:

You must specify either a method or transformerClass, but not both.



Usage

Also unless it's a read-only mapping, either @WriteTransformer annotation or @WriteTransformers annotation should be specified. Each WriteTransformer defines transformation of the attribute value to a single database column value (column is specified in the WriteTransformer).


Examples

See "Using @Transformation Annotation" for an example of how to use the @WriteTransformer annotation with a Transformation mapping.


See Also

For more information, see:

Comments powered by Disqus