Use @StructConverter
to enable custom processing of java.sql.Struct
types to process complex database types, such as spatial datatypes.
EclipseLink includes the JGeometryConverter
class to convert the Oracle JGeometry
spatial datatype.
Note: Unlike other converters, |
Annotation Elements
Table 2-65 describes this annotation's elements.
Table 2-65 @StructConverter Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
The |
none |
|
The converter class as a |
none |
Usage
You can use the existing @Convert
annotation with its value attribute set to the StructConverter
name – in this case, the appropriate settings are applied to the mapping. This setting is required on all mappings that use a type for which a StructConverter
has been defined. Failing to configure the mapping with the @Convert
will cause an error.
EclipseLink also includes additional converters, such as @ObjectTypeConverter
and @TypeConverter
.
Examples
Example 2-105 shows how to define the @StructConverter
annotation.
Example 2-105 Using @StructConverter Annotation
@StructConverter( name="JGeometryConverter" converter=JGeometryConverter.class.getName())
You can specify the @StructConverter
annotation anywhere in an Entity with the scope being the whole session. An exception is thrown if you add more than one StructConverter
annotation that affects the same Java type. An @StructConverter
annotation exists in the same namespaces as @Converter
. A validation exception is thrown if you add an @Converter
and an @StructConverter
of the same name.
See Also
For more information, see: