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


@TypeConverters

Use @TypeConverters to define multiple TypeConverter elements.


Annotation Elements

Table 2-73 describes this annotation's elements.

Table 2-73 @TypeConverters Annotation Elements

Annotation Element Description Default

TypeConverter[]

(Required) An array of type converter.




Examples

Example 2-117 shows how to use this annotation.

Example 2-117 Using @TypeConverters Annotation

@Entity
@TypeConverters({
    @TypeConverter(name="BigIntegerToString",dataType=String.class,objectType=BigInteger.class)
    })
public class Parameters implements Serializable {
    private static final long serialVersionUID = -1979843739878183696L;
    @Column(name="maxValue", nullable=false, length=512)
    @Convert("BigIntegerToString")
    private BigInteger maxValue;
...
}

Example 2-117 shows how to use the <type-converters> element in the eclipselink-orm.xml file.

Example 2-118 Using <type-converters> XML

<type-converters>
    <type-converter name="Long2String" data-type="String" object-type="Long"/>
    <type-converter name="String2String" data-type="String" object-type="String"/>
</type-converters>
<entity class="Employee">
...
</entity>


See Also

For more information, see:

Comments powered by Disqus