Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring a Serialized Object Converter

A serialized object converter can be used to store an arbitrary object or set of objects into a data source binary large object (BLOB) field. It uses the Java serializer so the target must be serializable.

For more information about the serialized object converter, see "Serialized Object Converter".

Table 35-10 summarizes which mappings support this option.

Table 35-10 Mapping Support for Serialized Object Converter

Mapping | Using TopLink Workbench | Using Java
--- | --- | ---
Relational Mappings |  |
Direct-to-Field Mapping |  |
Object-Relational Mappings |  |
Object-Relational Array Mapping |  |
EIS Mappings |  |
EIS Direct Mapping |  |
EIS Composite Direct Collection Mapping |  |
XML Mappings |  |
XML Direct Mapping |  |
XML Composite Direct Collection Mapping |  |

## Using TopLink Workbench

To create an serialized object direct mapping, use this procedure:

1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.

2. Click the Converter tab. The Converter tab appears.

   Figure 35-10 Converter Tab, Serialized Object Mapping

   Description of "Figure 35-10 Converter Tab, Serialized Object Mapping"

To specify a serialized object converter, select the Serialized Object Converter option.

## Using Java

You can set an `oracle.toplink.converters.SerializedObjectConverter` on any instance of `oracle.toplink.mappings.foundation.AbstractCompositeDirectCollectionMapping` using `AbstractCompositeDirectCollectionMapping` method `setValueConverter` as Example 35-11 shows.

Example 35-11 Configuring a SerializedObjectConverter in Java

    // Create SerializedObjectConverter instance
    SerializedObjectConverter serializedObjectConvter = new SerializedObjectConverter();

    // Set SerializedObjectConverter on ArrayMapping
    ArrayMapping arrayMapping = new ArrayMapping();
    arrayMapping.setValueConverter(serializedObjectConvter);
    arrayMapping.setAttributeName("responsibilities");
    arrayMapping.setStructureName("Responsibilities_t");
    arrayMapping.setFieldName("RESPONSIBILITIES");
    orDescriptor.addMapping(arrayMapping);