Use @TypeConverters
to define multiple TypeConverter
elements.
Table 2-73 describes this annotation's elements.
Table 2-73 @TypeConverters Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
(Required) An array of type converter. |
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>
For more information, see: