Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Configuring a Relational Direct Map Mapping (ELUG)"

m
m
Line 1: Line 1:
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
[[Special:Whatlinkshere/Configuring a Relational Direct Map Mapping (ELUG)|Related Topics]]</div>
+
[[Special:Whatlinkshere/Configuring a Relational Direct Map Mapping (ELUG)|Related Topics]]</div>This section describes the various components that you must configure in order to use a relational direct map mapping.
 
+
 
+
This section describes the various components that you must configure in order to use a relational direct map mapping.
+
  
 
For information on how to configure EclipseLink mappings options common to two or more mapping types, see [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Mapping]].
 
For information on how to configure EclipseLink mappings options common to two or more mapping types, see [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Mapping]].
Line 9: Line 6:
 
For information on how to create EclipseLink mappings, see [[Creating%20a%20Mapping%20(ELUG)|Creating a Mapping]].
 
For information on how to create EclipseLink mappings, see [[Creating%20a%20Mapping%20(ELUG)|Creating a Mapping]].
  
[[#Table 43-1|Configurable Options for Relational Direct Map Mapping]] lists the configurable options for a relational direct map mapping.
 
 
 
 
==Introduction to Relational Direct Map Mapping Configuration==
 
 
This table lists the configurable options for a relational direct map mapping.
 
This table lists the configurable options for a relational direct map mapping.
  
  
 
<span id="Table 43-1"></span>
 
<span id="Table 43-1"></span>
''''' Configurable Options for Relational Direct Map Mapping'''''
+
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Relational Direct Map Mapping" summary="This table lists the configurable options for relational direct map mappings and categorizes them as Basic and Advanced and indicates if the option can be configured with the Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Relational Direct Map Mapping" summary="This table lists the configurable options for relational direct map mappings and categorizes them as Basic and Advanced and indicates if the option can be configured with the TopLink Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
! id="r1c1-t2" align="left" valign="bottom" | '''Option'''
 
! id="r1c1-t2" align="left" valign="bottom" | '''Option'''
Line 124: Line 115:
 
     descriptor.addMapping(mapping);
 
     descriptor.addMapping(mapping);
 
  }
 
  }
 +
  
 
For more information, see the following:
 
For more information, see the following:
Line 200: Line 192:
 
| id="r3c1-t3" headers="r1c1-t3" align="left" | '''Serialized Object''' '''Converter'''
 
| id="r3c1-t3" headers="r1c1-t3" align="left" | '''Serialized Object''' '''Converter'''
 
| headers="r3c1-t3 r1c2-t3" align="left" |
 
| headers="r3c1-t3 r1c2-t3" align="left" |
See [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Serialized Object Converter]].
+
See [[Configuring%20a%20Mapping%20(ELUG)#Configuring a Serialized Object Converter|Configuring a Serialized Object Converter]].
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r4c1-t3" headers="r1c1-t3" align="left" | '''Type Conversion Converter'''
 
| id="r4c1-t3" headers="r1c1-t3" align="left" | '''Type Conversion Converter'''
 
| headers="r4c1-t3 r1c2-t3" align="left" |
 
| headers="r4c1-t3 r1c2-t3" align="left" |
See [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Type Conversion Converter]].
+
See [[Configuring%20a%20Mapping%20(ELUG)#Configuring a Type Conversion Converter|Configuring a Type Conversion Converter]].
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r5c1-t3" headers="r1c1-t3" align="left" | '''Object Type''' '''Converter'''
 
| id="r5c1-t3" headers="r1c1-t3" align="left" | '''Object Type''' '''Converter'''
 
| headers="r5c1-t3 r1c2-t3" align="left" |
 
| headers="r5c1-t3 r1c2-t3" align="left" |
See [[Configuring%20a%20Mapping%20(ELUG)|Configuring an Object Type Converter]].
+
See [[Configuring%20a%20Mapping%20(ELUG)#Configuring an Object Type Converter|Configuring an Object Type Converter]].
 
|}
 
|}
  
Line 268: Line 260:
 
[[Category: Task]]
 
[[Category: Task]]
 
[[Category: Draft]]
 
[[Category: Draft]]
 +
[[Category: ORM]]

Revision as of 07:59, 17 December 2007

This section describes the various components that you must configure in order to use a relational direct map mapping.

For information on how to configure EclipseLink mappings options common to two or more mapping types, see Configuring a Mapping.

For information on how to create EclipseLink mappings, see Creating a Mapping.

This table lists the configurable options for a relational direct map mapping.


Option Workbench Java

Configuring Target Table

Supported

Supported

Direct value field

Supported

Supported

Direct key field

Supported

Supported

Method or direct field access

Supported

Supported

Read-only mapping

Supported

Supported

Batch reading

Supported

Supported

Indirection (lazy loading)

Supported

Supported

Container policy

Supported

Supported

Mapping comments

Supported

Supported

Key converters

Supported

Supported

Value converters

Supported

Supported

Table and field references

Supported

Supported


This example shows how to create a direct map mapping and add it to a descriptor using Java code.

Direct Map Mapping

public void customize(ClassDescriptor descriptor) { 
   DirectMapMapping mapping = new DirectMapMapping();  

   // configure mapping
   ... 

   // add mapping to descriptor
   descriptor.addMapping(mapping);
}


For more information, see the following:

For information on using JPA to configure direct map mappings, see How to Use the @BasicMap Annotation.


Configuring Direct Value Field

The direct value field in the reference table stores the primitive data value of the map value. If the value's object value and database value are different types, use a converter (see Configuring Value Converters).


How to Configure Direct Value Fields Using Workbench

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Click the General tab. The General tab appears.
    General Tab, Direct Value Field
    General Tab, Direct Value Field
  3. Use the Direct Value Field list to select the field from the Target Table table that contains the object of the direct map mapping.



How to Configure Direct Value Fields Using Java

Use the DirectMapMapping method setDirectFieldName to set the direct fields for your mapping.

For more information about the available methods for DirectMapMapping, see the EclipseLink API Reference.


Configuring Direct Key Field

The direct key field in the reference table stores the primitive data value of the map key. If the key's object value and database value are different types, use a converter (see Configuring Key Converters).


How to Configure Direct Key Field Using Workbench

To specify the direct key field in the reference table, use this procedure.

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Click the General tab. The General tab appears.
    General Tab, Direct Key Field
    General Tab, Direct Key Field
  3. Use the Direct Key Field list to select the key from the Target Table table that contains the object of the direct map mapping.


How to Configure Direct Key Field Using Java

Use the DirectMapMapping method setDirectKeyFieldName to set the direct key field for your mapping.

For more information about the available methods for DirectMapMapping, see the EclipseLink API Reference.


Configuring Key Converters

If the key's object value and database value are different types, use a converter. EclipseLink supports the following key converters:


How to Configure Key Converters Using Workbench

Use this procedure to specify the converter for a direct map mapping key:

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Click the Converter tab. The Converter tab appears.
  3. Click the Key Converter tab. The Key Converter tab appears.
    Converter Tab, Key Converter Subtab
    Converter Tab, Key Converter Subtab
  4. Select the appropriate Key Converter.
Converter Description
No Converter Do not use a Key Converter for this mapping.
Serialized Object Converter

See Configuring a Serialized Object Converter.

Type Conversion Converter

See Configuring a Type Conversion Converter.

Object Type Converter

See Configuring an Object Type Converter.



How to Configure Key Converters Using Java

You can configure whether or not to allow null values using the DirectMapMapping method setKeyConverter.

For more information about the available methods for DirectMapMapping, see the EclipseLink API Reference.


Configuring Value Converters

If the value's object value and database value are different types, use a converter. EclipseLink supports the following value converters:


How to Configure Value Converters Using Workbench

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.
  2. Click the Converter tab. The Converter tab appears.
  3. Click the Value Converter tab. The Value Converter tab appears.
    Converter Tab, Value Converter Subtab
    Converter Tab, Value Converter Subtab
  4. Select the appropriate Value Converter.
Converter Description
No Converter Do not use a Value Converter for this mapping.
Serialized Object Converter

Configuring a Serialized Object Converter

Type Conversion Converter

Configuring a Type Conversion Converter

Object Type Converter

Configuring an Object Type Converter




Copyright Statement

Back to the top