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


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.


Unlike other converters, @StructConverter has its own interface.

Annotation Elements

Table 2-65 describes this annotation's elements.

Table 2-65 @StructConverter Annotation Elements

Annotation Element Description Default


The String name for your converter. Ensure that this name is unique across the persistence unit.



The converter class as a String. This class must implement the org.eclipse.persistence.platform.database.converters.StructConverter interface.



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.


Example 2-105 shows how to define the @StructConverter annotation.

Example 2-105 Using @StructConverter Annotation


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: