Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
A type conversion converter is used to explicitly map a data source type to a Java type.
For more information about the type conversion converter, see "Type Conversion Converter".
Table 35-11 summarizes which mappings support this option.
Table 35-11 Mapping Support for Type Conversion Converter
Mapping | Using TopLink Workbench
|
Using Java
|
---|---|---|
|
|
|
|
|
|
|
|
|
Object-Relational Array Mapping |
![]() |
|
|
|
|
|
|
|
EIS Composite Direct Collection Mapping |
|
|
|
|
|
|
|
|
XML Composite Direct Collection Mapping |
|
|
To create an type conversion direct mapping, use this procedure:
Select the mapped attribute in the Navigator. Its properties appear in the Editor.
Click the Converter tab. The Converter tab appears.
Select the Type Conversion Converter option.
Figure 35-11 Converter Tab, Type Conversion Mapping
Use the following information to complete the Type Conversion Converter fields on the Converter tab:
Field | Description |
---|---|
Data Type | Select the Java type of the data in the data source. |
Attribute Type | Select the Java type of the attribute in the Java class. |
You can set an oracle.toplink.converters.TypeConversionConverter
on any instance of oracle.toplink.mappings.foundation.AbstractCompositeDirectCollectionMapping
using AbstractCompositeDirectCollectionMapping
method setValueConverter
as Example 35-12 shows.
Example 35-12 Configuring a TypeConversionConverter in Java
// Create TypeConversionConverter instance TypeConversionConverter typeConversionConverter = new TypeConversionConverter(); typeConversionConverter.setDataClass(); typeConversionConverter.setObjectClass(); // Set TypeConversionConverter on ArrayMapping ArrayMapping arrayMapping = new ArrayMapping(); arrayMapping.setValueConverter(typeConversionConverter); arrayMapping.setAttributeName("responsibilities"); arrayMapping.setStructureName("Responsibilities_t"); arrayMapping.setFieldName("RESPONSIBILITIES"); orDescriptor.addMapping(arrayMapping);
Configure the TypeConversionConverter
instance using the following API:
setDataClass(java.lang.Class dataClass)
–to specify the data type class
setObjectClass(java.lang.Class objectClass)
–to specify the object type class