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 Mapping (ELUG)"

m
m
Line 1: Line 1:
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
+
<div style="float:right;border:1px solid #000000;padding:5px">__TOC__
[[Special:Whatlinkshere/Configuring a Mapping (ELUG)|Related Topics]]</div>
+
[[Special:Whatlinkshere/One-to-One Mapping (ELUG)|Related Topics]]</div>
This section describes how to configure EclipseLink mapping options common to two or more mapping types. This table lists the types of EclipseLink mappings that you can configure and provides a cross-reference to the type-specific chapter that lists the configurable options supported by that type.
+
This section describes the various components that you must configure in order to use a relational one-to-one mapping.
  
<span id="Table 117-1"></span>
+
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]].
{| class="HRuleFormalMax" dir="ltr" title="Configuring EclipseLink Mappings" summary="This table provides a cross-reference to additional mapping configuration options for each type of mapping." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
 
 +
For information on how to create EclipseLink mappings, see [[Creating%20a%20Mapping%20(ELUG)|Creating a Mapping]].
 +
 
 +
This table lists the configurable options for a relational one-to-one mapping.
 +
 
 +
 
 +
<span id="Table 36-1"></span>
 +
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Relational One-to-One Mapping" summary="This table lists the configurable options common to Relational One-to-One Mapping 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"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
! id="r1c1-t2" align="left" valign="bottom" | '''If you are creating...'''
+
! id="r1c1-t2" align="left" valign="bottom" | '''Option to Configure'''
! id="r1c2-t2" align="left" valign="bottom" | '''See...'''
+
! id="r1c2-t2" align="left" valign="bottom" | '''Workbench'''
 +
! id="r1c3-t2" align="left" valign="bottom" | '''Java'''
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
[[Configuring%20a%20Relational%20Mapping%20(ELUG)#Configuring Reference Descriptor|Reference descriptor ]]
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
| headers="r2c1-t2 r1c2-t2" align="left" |
[[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]]<br>
+
[[Image:support.gif|Supported]]
 +
| headers="r2c1-t2 r1c3-t2" align="left" |
 +
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Method or Direct Field Accessing at the Mapping Level|Method or direct field access]]
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
| headers="r3c1-t2 r1c2-t2" align="left" |
[[Configuring an Object-Relational Data Type Mapping (ELUG)|Configuring an Object-Relational Data Type Mapping]]<br>
+
[[Image:support.gif|Supported]]
 +
| headers="r3c1-t2 r1c3-t2" align="left" |
 +
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Read-Only Mappings|Read-only mapping ]]
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
| headers="r4c1-t2 r1c2-t2" align="left" |
[[Configuring%20an%20EIS%20Mapping%20(ELUG)|Configuring an EIS Mapping]]<br>
+
[[Image:support.gif|Supported]]
 +
| headers="r4c1-t2 r1c3-t2" align="left" |
 +
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Private or Independent Relationships|Private or Independent relationships]])
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
| headers="r5c1-t2 r1c2-t2" align="left" |
[[Configuring%20an%20XML%20Mapping%20(ELUG)|Configuring an XML Mapping]]<br>
+
[[Image:support.gif|Supported]]
|}
+
| headers="r5c1-t2 r1c3-t2" align="left" |
 
+
[[Image:support.gif|Supported]]
<br>
+
 
+
The [[#Table 117-2|Common Mapping Options]] table lists the configurable options shared by two or more EclipseLink mapping types.
+
 
+
For more information, see the following:
+
* [[Creating%20a%20Mapping%20(ELUG)#Introduction to Mapping Creation|Introduction to Mapping Creation]]
+
* [[Introduction%20to%20Mappings%20(ELUG)|Introduction to Mappings]]
+
 
+
 
+
 
+
==Configuring Common Mapping Options==
+
This table lists the configurable options shared by two or more EclipseLink mapping types. In addition to the configurable options described here, you must also configure the options described for the specific mapping types (see [[Introduction%20to%20Mappings%20(ELUG)#Mapping Types|Mapping Types]]), as shown in the [[#Table 117-1| Configuring EclipseLink Mappings]] table.
+
 
+
 
+
<span id="Table 117-2"></span>
+
''''' Common Mapping Options'''''
+
 
+
{| class="RuleFormalMax" dir="ltr" title="Common Mapping Options" summary="This table lists the configurable options shared by two or more mapping types" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
 
|- align="left" valign="top"
 
|- align="left" valign="top"
! id="r1c1-t3" align="left" valign="bottom" | '''Option to Configure'''
+
| id="r6c1-t2" headers="r1c1-t2" align="left" |
! id="r1c2-t3" align="left" valign="bottom" | '''Workbench<br>'''
+
[[Configuring%20a%20Relational%20Mapping%20(ELUG)#Configuring Batch Reading|Batch reading ]]
! id="r1c3-t3" align="left" valign="bottom" | '''Java'''
+
| headers="r6c1-t2 r1c2-t2" align="left" |
 +
[[Image:support.gif|Supported]]
 +
| headers="r6c1-t2 r1c3-t2" align="left" |
 +
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r2c1-t3" headers="r1c1-t3" align="left" |
+
| id="r7c1-t2" headers="r1c1-t2" align="left" |
[[#Configuring_Read-Only_Mappings|Read-only]]
+
[[Configuring%20a%20Relational%20Mapping%20(ELUG)#Configuring Joining at the Mapping Level|Joining ]]
| headers="r2c1-t3 r1c2-t3" align="left" |
+
| headers="r7c1-t2 r1c2-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
| headers="r2c1-t3 r1c3-t3" align="left" |
+
| headers="r7c1-t2 r1c3-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r3c1-t3" headers="r1c1-t3" align="left" |
+
| id="r8c1-t2" headers="r1c1-t2" align="left" |
[[#Configuring Indirection (Lazy Loading)|Indirection (lazy loading)]]
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Indirection (Lazy Loading)|Indirection (lazy loading)]])
| headers="r3c1-t3 r1c2-t3" align="left" |
+
| headers="r8c1-t2 r1c2-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
| headers="r3c1-t3 r1c3-t3" align="left" |
+
| headers="r8c1-t2 r1c3-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r4c1-t3" headers="r1c1-t3" align="left" |
+
| id="r9c1-t2" headers="r1c1-t2" align="left" |
[[#Configuring XPath|XPath]]
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Bidirectional Relationship|Bidirectional relationship ]]
| headers="r4c1-t3 r1c2-t3" align="left" |
+
| headers="r9c1-t2 r1c2-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
| headers="r4c1-t3 r1c3-t3" align="left" |
+
| headers="r9c1-t2 r1c3-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r5c1-t3" headers="r1c1-t3" align="left" |
+
| id="r10c1-t2" headers="r1c1-t2" align="left" |
[[#Configuring a Default Null Value at the Mapping Level|Default null value]]
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Mapping Comments|Mapping comments ]]
| headers="r5c1-t3 r1c2-t3" align="left" |
+
| headers="r10c1-t2 r1c2-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
| headers="r5c1-t3 r1c3-t3" align="left" |
+
| headers="r10c1-t2 r1c3-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:unsupport.gif|Supported]]
 
|- align="left" valign="top"
 
|- align="left" valign="top"
| id="r6c1-t3" headers="r1c1-t3" align="left" |
+
| id="r11c1-t2" headers="r1c1-t2" align="left" |
[[#Configuring Method or Direct Field Accessing at the Mapping Level|Method or direct field access]]
+
Table and field references (see [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring Joining at the Mapping Level]])
| headers="r6c1-t3 r1c2-t3" align="left" |
+
| headers="r11c1-t2 r1c2-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
| headers="r6c1-t3 r1c3-t3" align="left" |
+
| headers="r11c1-t2 r1c3-t2" align="left" |
[[Image:support.gif|Supported]]<br>
+
[[Image:support.gif|Supported]]
|- align="left" valign="top"
+
| id="r7c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Private or Independent Relationships|Private or independent relationships]]
+
| headers="r7c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r7c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Mapping Comments|Comments]]
+
| headers="r8c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r8c1-t3 r1c3-t3" align="left" |
+
[[Image:unsupport.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring a Serialized Object Converter|Serialized object converter]]
+
| headers="r9c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r9c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring a Type Conversion Converter|Serialized type conversion converter]]
+
| headers="r10c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r10c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring an Object Type Converter|Object type converter]]
+
| headers="r11c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r11c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r12c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring a Simple Type Translator|Simple type translator]]
+
| headers="r12c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r12c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r13c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring a JAXB Typesafe Enumeration Converter|JAXB typesafe enumeration converter]]
+
| headers="r13c1-t3 r1c2-t3" align="left" |
+
[[Image:unsupport.gif|Supported]]<br>
+
| headers="r13c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r14c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Container Policy|Container policy]]
+
| headers="r14c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r14c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r15c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Attribute Transformer|Attribute transformer]]
+
| headers="r15c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r15c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r16c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Field Transformer Associations|Field transformer associations]]
+
| headers="r16c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r16c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r17c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Mutable Mappings|Mutable mappings]]
+
| headers="r17c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r17c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r18c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring Bidirectional Relationship|Bidirectional relationship]]
+
| headers="r18c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r18c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r19c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring the Use of a Single Node|Use of a single node]]
+
| headers="r19c1-t3 r1c2-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
| headers="r19c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
|- align="left" valign="top"
+
| id="r20c1-t3" headers="r1c1-t3" align="left" |
+
[[#Configuring the Use of CDATA|Use of CDATA]]
+
| headers="r20c1-t3 r1c2-t3" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r20c1-t3 r1c3-t3" align="left" |
+
[[Image:support.gif|Supported]]<br>
+
 
|}
 
|}
  
<br>
 
  
 +
This example shows how to create a one-to-one mapping and add it to a descriptor using Java code.
  
==Configuring Read-Only Mappings==
+
<span id="Example 38-1"></span>
 +
''''' One-to-One Mapping'''''
  
Mappings that are read-only will not be affected during insert, update, and delete operations.
+
<pre>
 +
public void customize(ClassDescriptor descriptor) {
 +
    OneToOneMapping mapping = new OneToOneMapping(); 
  
Use read-only mappings when multiple attributes in an object map to the same fields in the database but only one of the mappings can write to the field.
+
    // configure mapping
 +
    ...  
  
You can also use read-only mappings with bi-directional many-to-many mappings to designate which mapping will be responsible for updating the many-to-many join table.
+
    // add mapping to descriptor
 
+
    descriptor.addMapping(mapping);
<br>
+
}
 
+
</pre>
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note'''<nowiki>:</nowiki> The primary key mappings cannot not be read-only.
+
|}
+
 
+
 
+
Mappings defined for the write-lock or class indicator field must be read-only, unless the write-lock is configured not to be stored in the cache or the class indicator is part of the primary key.
+
 
+
Use read-only mappings only if specific mappings in a descriptor are read-only. If the ''entire descriptor'' is read-only, use the descriptor-level setting (see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Read-Only Descriptors|Configuring Read-Only Descriptors]]).
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-3"></span>
+
''''' Mapping Support for Read-Only'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Read-Only" summary="This table summarizes which mappings support read-only." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t5" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t5" align="left" valign="bottom" | '''[[#How to Configure Read-Only Mappings Using Workbench|Using the Workbench]]'''
+
! id="r1c3-t5" align="left" valign="bottom" | '''[[#How to Configure Read-Only Mappings Using Java|Using Java]]'''
+
|- align="left" valign="top"
+
| id="r2c1-t5" headers="r1c1-t5" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t5 r1c2-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r2c1-t5 r1c3-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r3c1-t5" headers="r1c1-t5" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r3c1-t5 r1c2-t5" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t5 r1c3-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t5" headers="r1c1-t5" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r4c1-t5 r1c2-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t5 r1c3-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t5" headers="r1c1-t5" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r5c1-t5 r1c2-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t5 r1c3-t5" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure Read-Only Mappings Using Workbench===
+
 
+
To specify a mapping as read-only, use this procedure:
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-1"></span>''''' General Tab, Read-Only Option'''''<br>[[Image:mpdbgen3.gif|General Tab, Read-Only Option]]<br><br>
+
 
+
Select the '''Read-Only''' option to set the mapping to be read-only and not affected during update and delete operations.
+
 
+
'''See Also'''
+
: [[#Configuring Read-Only Mappings|Configuring Read-Only Mappings]]
+
: [[#Configuring a Mapping|Configuring a Mapping]]
+
 
+
 
+
 
+
===How to Configure Read-Only Mappings Using Java===
+
Use the following <tt>DatabaseMapping</tt> methods to configure the read access of a mapping:
+
* <tt>readOnly</tt>–configures mapping read access to read-only;
+
* <tt>readWrite</tt>–configures mapping read access to read and write (default).
+
 
+
This example shows how to use these methods with a class that has a read-only attribute named <tt>phones</tt>.
+
 
+
<span id="Example 117-1"></span>
+
''''' Configuring Read Only Mappings in Java'''''
+
'''// Map the phones attribute'''
+
phonesMapping.setAttributeName("phones");
+
 
+
'''// Specify read-only'''
+
phonesMapping.readOnly();
+
 
+
 
+
 
+
==Configuring Indirection (Lazy Loading)==
+
 
+
If indirection is not enabled, when EclipseLink retrieves a persistent object, it retrieves all of the dependent objects to which it refers. When you enable indirection (lazy loading) for an attribute mapped with a relationship mapping, EclipseLink uses an indirection object as a placeholder for the referenced object: EclipseLink defers reading the dependent object until you access that specific attribute. This can result in a significant performance improvement, especially if the application is interested only in the contents of the retrieved object rather than the objects to which it refers.
+
 
+
We strongly recommend using indirection for all relationship mappings. Not only does this allow you to optimize data source access, but it also allows EclipseLink to optimize the unit of work processing, cache access, and concurrency.
+
 
+
This table summarizes which mappings support this option.
+
 
+
<span id="Table 117-4"></span>
+
''''' Mapping Support for Indirection'''''
+
 
+
{| class="RuleFormalWideMax" dir="ltr" title="Mapping Support for Indirection" summary="This table summarizes which mappings support indirection." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t6" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t6" align="left" valign="bottom" | '''[[Introduction%20to%20Mappings%20(ELUG)#Value Holder Indirection|Value Holder Indirection]]'''
+
! id="r1c3-t6" align="left" valign="bottom" | '''[[Introduction%20to%20Mappings%20(ELUG)#Transparent Indirect Container Indirection|Transparent Indirect Container Indirection]]<br>'''
+
! id="r1c4-t6" align="left" valign="bottom" | '''[[Introduction%20to%20Mappings%20(ELUG)#Proxy Indirection|Proxy Indirection]]<br>'''
+
! id="r1c5-t6" align="left" valign="bottom" | '''[[#How to Configure Indirection Using Workbench|How to Configure Indirection Using Workbench]]<br>'''
+
! id="r1c6-t6" align="left" valign="bottom" | '''[[#How to Configure Indirection Using Java|How to Configure Indirection Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]
+
| headers="r2c1-t6 r1c2-t6" align="left" | <br>
+
| headers="r2c1-t6 r1c3-t6" align="left" | <br>
+
| headers="r2c1-t6 r1c4-t6" align="left" | <br>
+
| headers="r2c1-t6 r1c5-t6" align="left" | <br>
+
| headers="r2c1-t6 r1c6-t6" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-Field Mapping|Direct-to-Field Mapping]]
+
| headers="r3c1-t6 r1c2-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t6 r1c5-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Transformation Mapping|Transformation Mapping]]<br>
+
| headers="r4c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t6 r1c3-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r4c1-t6 r1c4-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r4c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-One Mapping|One-to-One Mapping]]<br>
+
| headers="r5c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t6 r1c3-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r5c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Variable One-to-One Mapping|Variable One-to-One Mapping]]<br>
+
| headers="r6c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t6 r1c3-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r6c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-Many Mapping|One-to-Many Mapping]]<br>
+
| headers="r7c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Many-to-Many Mapping|Many-to-Many Mapping]]<br>
+
| headers="r8c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Collection Mapping|Aggregate Collection Mapping]]<br>
+
| headers="r9c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t6 r1c4-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r9c1-t6 r1c5-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r9c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Collection Mapping|Direct Collection Mapping]]<br>
+
| headers="r10c1-t6 r1c2-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r10c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t6 r1c4-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r10c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Map Mapping|Direct Map Mapping]]
+
| headers="r11c1-t6 r1c2-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r11c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t6 r1c4-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r11c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r12c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)|Object-Relational Data Type Mappings]]<br>
+
| headers="r12c1-t6 r1c2-t6" align="left" | <br>
+
| headers="r12c1-t6 r1c3-t6" align="left" | <br>
+
| headers="r12c1-t6 r1c4-t6" align="left" | <br>
+
| headers="r12c1-t6 r1c5-t6" align="left" | <br>
+
| headers="r12c1-t6 r1c6-t6" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r13c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Reference Mapping|Object-Relational Data Type Reference Mapping]]
+
| headers="r13c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t6 r1c5-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r13c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r14c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)|Object-Relational Data Type Nested Table Mapping]]
+
| headers="r14c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t6 r1c5-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r14c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r15c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)|EIS Mappings]]
+
| headers="r15c1-t6 r1c2-t6" align="left" | <br>
+
| headers="r15c1-t6 r1c3-t6" align="left" | <br>
+
| headers="r15c1-t6 r1c4-t6" align="left" | <br>
+
| headers="r15c1-t6 r1c5-t6" align="left" | <br>
+
| headers="r15c1-t6 r1c6-t6" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r16c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-One Mapping|EIS One-to-One Mapping]]
+
| headers="r16c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r16c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r16c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r16c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r16c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r17c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)|EIS One-to-Many Mapping]]
+
| headers="r17c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t6 r1c4-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t6 r1c5-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r18c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)|XML Mappings]]
+
| headers="r18c1-t6 r1c2-t6" align="left" | <br>
+
| headers="r18c1-t6 r1c3-t6" align="left" | <br>
+
| headers="r18c1-t6 r1c4-t6" align="left" | <br>
+
| headers="r18c1-t6 r1c5-t6" align="left" | <br>
+
| headers="r18c1-t6 r1c6-t6" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r19c1-t6" headers="r1c1-t6" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)|XML Transformation Mapping]]
+
| headers="r19c1-t6 r1c2-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t6 r1c3-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t6 r1c4-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r19c1-t6 r1c5-t6" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r19c1-t6 r1c6-t6" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
In general, we recommend that you use value holder indirection for one-to-one mappings and transparent indirect container indirection for collection mappings. Enable indirection for transformation mappings if the execution of the transformation is a resource-intensive task (such as accessing a database, in a relational project).
+
 
+
When using indirection with EJB, the version of EJB and application server you use affects how indirection is configured and what types of indirection are applicable.
+
 
+
When using indirection with an object that your application serializes, you must consider the effect of any untriggered indirection objects at deserialization time.
+
 
+
For JPA entities or POJO classes that you configure for weaving, EclipseLink weaves value holder indirection for one-to-one mappings. If you want EclipseLink to weave change tracking and your application includes collection mappings (one-to-many or many-to-many), then you must configure all collection mappings to use transparent indirect container indirection only (you may not configure your collection mappings to use eager loading nor value holder indirection).
+
  
 
For more information, see the following:
 
For more information, see the following:
* [[Introduction%20to%20Mappings%20(ELUG)#Indirection (Lazy Loading)|Indirection (Lazy Loading)]]
 
* [[Introduction%20to%20Mappings%20(ELUG)#Value Holder Indirection|Value Holder Indirection]]
 
* [[Introduction%20to%20Mappings%20(ELUG)#Transparent Indirect Container Indirection|Transparent Indirect Container Indirection]]
 
* [[Introduction%20to%20Mappings%20(ELUG)#Indirection, Serialization, and Detachment|Indirection, Serialization, and Detachment]]
 
* [[Introduction to EclipseLink%20Application%20Development%20(ELUG)#Using Weaving|Using Weaving]]
 
* [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#Using EclipseLink JPA Weaving|Using EclipseLink JPA Weaving]]
 
  
 +
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)|One-to-One Mapping]]
 +
* [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]]
 +
* [[Creating%20and%20Configuring%20Mappings%20(ELUG)|Creating and Configuring Mappings]]
  
  
===How to Configure Indirection Using Workbench===
+
For information on using JPA to configure one-to-one mappings, see [[Introduction%20to%20EclipseLink%20JPA%20(ELUG)|@OneToOne]].
 
+
To complete the indirection options on a mapping's '''General''' tab use this procedure:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-2"></span>''''' General Tab, Indirection Options'''''<br>[[Image:indirection.gif|General Tab, Indirection Options]]<br><br>
+
# Select the '''Use Indirection''' option and indicate the type of indirection to use.
+
 
+
Use the following information to complete the '''Indirection''' fields on the tab:
+
{| class="HRuleInformal" dir="ltr" title="This table identifies the Indirection options on the General tab of a mapping" summary="This table identifies the Indirection options on the General tab of a mapping" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t7" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t7" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t7" headers="r1c1-t7" align="left" | '''Use Indirection'''
+
| headers="r2c1-t7 r1c2-t7" align="left" | Specify if this mapping uses indirection.
+
|- align="left" valign="top"
+
| id="r3c1-t7" headers="r1c1-t7" align="left" | '''ValueHolder'''
+
| headers="r3c1-t7 r1c2-t7" align="left" |
+
Specify that the mapping uses '''Value Holder''' indirection. See [[Introduction%20to%20Mappings%20(ELUG)#Value Holder Indirection|Value Holder Indirection]] for more information.
+
|- align="left" valign="top"
+
| id="r4c1-t7" headers="r1c1-t7" align="left" | '''Proxy'''
+
| headers="r4c1-t7 r1c2-t7" align="left" |
+
Specify that the mapping uses '''Proxy''' indirection. See [[Introduction%20to%20Mappings%20(ELUG)#Proxy Indirection|Proxy Indirection]] for more information.
+
|}
+
 
+
<br>
+
 
+
'''See Also'''
+
: [[#Configuring Indirection (Lazy Loading)|Configuring Indirection (Lazy Loading)]]
+
 
+
 
+
 
+
===How to Configure Indirection Using Java===
+
When creating mappings through the Java API, all foreign reference mappings default to using value-holder indirection and all transformation mappings default to not using indirection.
+
 
+
To disable indirection use <tt>ForeignReferenceMapping</tt> method <tt>dontUseIndirection</tt>.
+
 
+
To enable value holder indirection, use <tt>ForeignReferenceMapping</tt> method <tt>useBasicIndirection</tt>.
+
 
+
To enable transparent container indirection, use one of the following <tt>CollectionMapping</tt> methods:
+
* <tt>useTransparentCollection</tt>
+
* <tt>useTransparentList</tt>
+
* <tt>useTransparentMap</tt>
+
* <tt>useTransparentSet</tt>
+
 
+
To enable proxy indirection, use <tt>ObjectReferenceMapping</tt> method <tt>useProxyIndirection</tt>.
+
 
+
This section provides additional information on the following:
+
 
+
* [[#Configuring ValueHolder Indirection|Configuring ValueHolder Indirection]]
+
* [[#Configuring ValueHolder Indirection With Method Accessing|Configuring ValueHolder Indirection With Method Accessing]]
+
* [[#Configuring IndirectContainer Indirection|Configuring IndirectContainer Indirection]]
+
* [[#Configuring Proxy Indirection|Configuring Proxy Indirection]]
+
 
+
 
+
 
+
====Configuring Value Holder Indirection====
+
 
+
Instances of <tt>org.eclipse.persistence.mappings.ForeignReferenceMapping</tt> and <tt>org.eclipse.persistence.mappings.foundation.AbstractTransformationMapping</tt> provide the <tt>useBasicIndirection</tt> method to configure a mapping to an attribute that you code with an <tt>org.eclipse.persistence.indirection.ValueHolderInterface</tt> between it and the real object.
+
 
+
If the attribute is of a <tt>Collection</tt> type (such as a <tt>Vector</tt>), then you can either use an <tt>IndirectContainer</tt> (see [[#Configuring IndirectContainer Indirection|Configuring IndirectContainer Indirection]]) or define the <tt>ValueHolder</tt> in the constructor as follows:
+
 
+
<tt>addresses = new ValueHolder(new Vector());</tt>
+
 
+
This example illustrates the <tt>Employee</tt> class using <tt>ValueHolder</tt> indirection. The class definition conceals the use of ValueHolder within the existing getter and setter methods.
+
 
+
<span id="Example 117-2"></span>
+
''''' Class Using ValueHolder Indirection'''''
+
public class Employee {
+
+
    protected ValueHolderInterface address;
+
+
    '''// Initialize ValueHolders in constructor'''
+
+
    public Employee() {
+
        address = new ValueHolder();
+
    }
+
+
    public Address getAddress() {
+
        return (Address) this.addressHolder.getValue();
+
    }
+
+
    public void setAddress(Address address) {
+
        this.addressHolder.setValue(address);
+
    }
+
}
+
 
+
 
+
 
+
This example shows how to configure a one-to-one mapping to the <tt>address</tt> attribute.
+
 
+
<span id="Example 117-3"></span>
+
''''' Mapping Using ValueHolder Indirection'''''
+
OneToOneMapping mapping = new OneToOneMapping();
+
mapping.useBasicIndirection();
+
mapping.setReferenceClass(Employee.class);
+
mapping.setAttributeName("address");
+
 
+
 
+
 
+
The application uses <tt>Employee</tt> methods <tt>getAddress</tt> and <tt>setAddress</tt> to access the <tt>Address</tt> object. Because basic indirection is enabled, EclipseLink expects the persistent fields to be of type <tt>ValueHolderInterface</tt>.
+
 
+
 
+
====Configuring Value Holder Indirection with Method Accessing====
+
If you are using <tt>ValueHolder</tt> indirection with method accessing (see [[#Configuring Method or Direct Field Accessing at the Mapping Level|Configuring Method or Direct Field Accessing at the Mapping Level]]), in addition to changing your attributes types in your Java code to <tt>ValueHolderInterface</tt>, you must also provide EclipseLink with two pairs of getter and setter methods:
+
* getter and setter of the ''indirection'' object that are registered with the mapping and used only by EclipseLink. They include a <tt>get</tt> method that returns an instance that conforms to <tt>ValueHolderInterface</tt>, and a <tt>set</tt> method that accepts one argument that conforms to the same interface;
+
* getter and setter of the actual attribute value used by the application.
+
 
+
This example illustrates the <tt>Employee</tt> class using <tt>ValueHolder</tt> indirection with method access. The class definition is modified so that the <tt>address</tt> attribute of <tt>Employee</tt> is a <tt>ValueHolderInterface</tt> instead of an <tt>Address</tt>, and appropriate getter and setter methods are supplied.
+
 
+
<span id="Example 117-4"></span>
+
''''' Class Using ValueHolder Indirection with Method Accessing'''''
+
public class Employee {
+
+
    protected ValueHolderInterface address;
+
+
    '''// Initialize ValueHolders in constructor'''
+
    public Employee() {
+
        address = new ValueHolder();
+
    }
+
+
    '''// getter and setter registered with the mapping and used only by EclipseLink'''
+
    public ValueHolderInterface getAddressHolder() {
+
        return address;
+
    }
+
    public void setAddressHolder(ValueHolderInterface holder) {
+
        address = holder;
+
    }
+
+
    '''// getter and setter methods used by the application to access the attribute'''
+
    public Address getAddress() {
+
        return (Address) address.getValue();
+
    }
+
+
    public void setAddress(Address theAddress) {
+
        address.setValue(theAddress);
+
    }
+
}
+
+
 
+
 
+
This example shows how to configure a one-to-one mapping to the <tt>address</tt> attribute.
+
 
+
<span id="Example 117-5"></span>
+
''''' Mapping Using ValueHolder Indirection with Method Accessing'''''
+
OneToOneMapping mapping = new OneToOneMapping();
+
mapping.useBasicIndirection();
+
mapping.setReferenceClass(Employee.class);
+
mapping.setAttributeName("address");
+
mapping.setGetMethodName("getAddressHolder");
+
mapping.setSetMethodName("setAddressHolder");
+
 
+
 
+
 
+
The application uses <tt>Employee</tt> methods <tt>getAddress</tt> and <tt>setAddress</tt> to access the <tt>Address</tt> object. Because basic indirection is enabled, EclipseLink uses <tt>Employee</tt> methods <tt>getAddressHolder</tt> and <tt>setAddressHolder</tt> methods when performing persistence operations on instances of <tt>Employee</tt>.
+
 
+
 
+
 
+
====Configuring Value Holder Indirection with JPA====
+
 
+
When using indirection with JPA, if your application serializes any indirection-enabled (lazily loaded) entity (see [[Introduction%20to%20Mappings%20(ELUG)#Indirection, Serialization, and Detachment|Indirection, Serialization, and Detachment]]), then, to preserve untriggered indirection objects on deserialization, configure your client to use EclipseLink agent, as follows:
+
 
+
#Include the following JAR files (from <tt><ECLIPSELINK_HOME>\jlib</tt>) in your client classpath:
+
#*<tt>eclipselink.jar</tt>
+
#*<tt>eclipselink-agent.jar</tt>
+
#*<tt>asm-util.jar.jar</tt>
+
#*<tt><your-application-persistence>.jar</tt>
+
#Add the following argument to the Java command line you use to start your client: <tt>-javaagent:eclipselink-agent.jar</tt>
+
<br>
+
You can also use static weaving (see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#How to Configure Static Weaving for JPA Entities|How to Configure Static Weaving for JPA Entities]]). This will provide you with better error messages and will resolve merging issues.
+
 
+
<br />
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note:''' The use of static weaving will not affect serialization as it functions without static weaving enabled.
+
|}
+
 
+
<br />
+
 
+
====Configuring IndirectContainer Indirection====
+
 
+
Instances of <tt>org.eclipse.persistence.mappings.ForeignReferenceMapping</tt> and <tt>org.eclipse.persistence.mappings.foundation.AbstractTransformationMapping</tt> provide the <tt>useContainerIndirection</tt> method to configure a mapping to an attribute that you code with an <tt>org.eclipse.persistence.indirection.IndirectContainer</tt> between it and the real object.
+
 
+
Using an <tt>IndirectContainer</tt>, a <tt>java.util.Collection</tt> class can act as a EclipseLink indirection object: the <tt>Collection</tt> will only read its contents from the database when necessary (typically, when a <tt>Collection</tt> accessor is invoked). Without an <tt>IndirectContainer</tt>, all members of the <tt>Collection</tt> must be retrieved when the <tt>Collection</tt> attribute is accessed.
+
 
+
The following example illustrates the <tt>Employee</tt> class using <tt>IndirectContainer</tt> indirection with method access. Note that the fact of using indirection is transparent.
+
 
+
 
+
<span id="Example 117-6"></span>
+
''''' Class Using IndirectContainer Indirection'''''
+
public class Employee {
+
+
    protected List addresses;
+
+
    public Employee() {
+
        this.addresses = new ArrayList();
+
    }
+
 
+
    public List getAddresses() {
+
        return this.addresses;
+
    }
+
+
    public void setAddresses(List addresses) {
+
        this.addresses = addresses;
+
    }
+
}
+
+
 
+
 
+
The following example shows how to configure a one-to-one mapping to the <tt>addresses</tt> attribute.
+
 
+
 
+
<span id="Example 117-7"></span>
+
''''' Mapping Using IndirectContainer Indirection'''''
+
OneToOneMapping mapping = new OneToOneMapping();
+
mapping.useBasicIndirection();
+
mapping.setReferenceClass(Employee.class);
+
mapping.setAttributeName("addresses");
+
mapping.setGetMethodName("getAddresses");
+
mapping.setSetMethodName("setAddresses");
+
 
+
====Configuring Proxy Indirection====
+
 
+
This example illustrates an <tt>Employee</tt> to <tt>Address</tt> one-to-one relationship.
+
 
+
 
+
<span id="Example 117-8"></span>
+
''''' Classes Using Proxy Indirection'''''
+
public interface Employee {
+
+
    public String getName();
+
    public Address getAddress();
+
    public void setName(String value);
+
    public void setAddress(Address value);
+
    . . .
+
}
+
+
public class EmployeeImpl implements Employee {
+
+
    public String name;
+
    public Address address;
+
    . . .
+
    public Address getAddress() {
+
        return this.address;
+
    }
+
+
    public void setAddress(Address value) {
+
        this.address = value;
+
    }
+
}
+
+
public interface Address {
+
+
    public String getStreet();
+
    public void setStreet(String value);
+
    . . .
+
}
+
+
public class AddressImpl implements Address {
+
+
    public String street;
+
    . . .
+
}
+
 
+
In the preceding example, both the <tt>EmployeeImpl</tt> and the <tt>AddressImpl</tt> classes implement public interfaces (<tt>Employee</tt> and <tt>Address</tt> respectively). Therefore, because the <tt>AddressImpl</tt> class is the target of the one-to-one relationship, it is the only class that must implement an interface. However, if the <tt>EmployeeImpl</tt> is ever to be the target of another one-to-one relationship using transparent indirection, it must also implement an interface, as the following example shows:
+
 
+
Employee emp = (Employee) session.readObject(Employee.class);
+
System.out.println(emp.toString());
+
System.out.println(emp.getAddress().toString());
+
'''// Would print:'''
+
[Employee] John Smith
+
{ IndirectProxy: not instantiated }
+
String street = emp.getAddress().getStreet();
+
'''// Triggers database read to get Address information'''
+
System.out.println(emp.toString());
+
System.out.println(emp.getAddress().toString());
+
'''// Would print:'''
+
[Employee] John Smith
+
{ [Address] 123 Main St. }
+
 
+
Using proxy indirection does not change how you instantiate your own domain objects for an insert operation. You still use the following code:
+
 
+
<tt>Employee emp = new EmployeeImpl("John Smith");</tt>
+
<tt>Address add = new AddressImpl("123 Main St.");</tt>
+
<tt>emp.setAddress(add);</tt>
+
 
+
The following example illustrates an <tt>Employee</tt> to <tt>Address</tt> one-to-one relationship mapping.
+
 
+
 
+
<span id="Example 117-9"></span>
+
''''' Mapping Using Proxy Indirection'''''
+
<pre>
+
OneToOneMapping mapping = new OneToOneMapping();
+
mapping.useProxyIndirection();
+
mapping.setReferenceClass(Employee.class);
+
mapping.setAttributeName("address");
+
mapping.setGetMethodName("getAddress");
+
mapping.setSetMethodName("setAddress");
+
</pre>
+
 
+
 
+
 
+
==Configuring XPath==
+
EclipseLink uses XPath statements to map the attributes of a Java object to locations in an XML document. When you create an XML mapping or EIS mapping using XML records, you can specify the XPath based on any of the following:
+
* Name
+
* Position
+
* Path and name
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-5"></span>
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for XPath" summary="This table summarizes which mappings support XPath" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t8" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t8" align="left" valign="bottom" | '''[[#How to Configure XPath Using Workbench|Using the Workbench]]<br>'''
+
! id="r1c3-t8" align="left" valign="bottom" | '''How to Use Java'''
+
|- align="left" valign="top"
+
| id="r2c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]] <sup>Foot 1 </sup>
+
| headers="r2c1-t8 r1c2-t8" align="left" | <br>
+
| headers="r2c1-t8 r1c3-t8" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r3c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r4c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Object Mapping|EIS Composite Object Mapping]]<sup>Foot 2 </sup>
+
| headers="r5c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Collection Mapping|EIS Composite Collection Mapping]]<br>
+
| headers="r6c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r7c1-t8 r1c2-t8" align="left" | <br>
+
| headers="r7c1-t8 r1c3-t8" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r8c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r8c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r9c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Object Mapping|XML Composite Object Mapping]]<br>
+
| headers="r10c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Collection Mapping|XML Composite Collection Mapping]]<br>
+
| headers="r11c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r12c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Any Object Mapping|XML Any Object Mapping]]<br>
+
| headers="r12c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r12c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r13c1-t8" headers="r1c1-t8" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Any Collection Mapping|XML Any Collection Mapping]]<br>
+
| headers="r13c1-t8 r1c2-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t8 r1c3-t8" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br><sup>Footnote 1 </sup>When used with XML records only (see [[Configuring%20an%20EIS%20Descriptor%20(ELUG)#Configuring Record Format|Configuring Record Format]]).<br><sup>Footnote 2 </sup>Supports the self XPath (".") so that the EclipseLink runtime performs all read and write operations in the parent's element and not an element nested within it (see [[Introduction%20to%20Mappings%20(ELUG)#Mappings and the jaxb:class Customization|Mappings and the jaxb:class Customization]]).<br>
+
 
+
Before you can select an XPath for a mapping, you must associate the descriptor with a schema context (see [[Configuring%20an%20EIS%20Descriptor%20(ELUG)#Configuring Schema Context for an EIS Descriptor|Configuring Schema Context for an EIS Descriptor]]or [[Configuring%20an%20XML%20Descriptor%20(ELUG)#Configuring Schema Context for an XML Descriptor|Configuring Schema Context for an XML Descriptor]]).
+
 
+
For more information, see [[Introduction%20to%20Mappings%20(ELUG)#Mappings and XPath|Mappings and XPath]].
+
 
+
 
+
 
+
===How to Configure XPath Using Workbench===
+
 
+
Use this table to select the XPath for an XMl mapping or EIS mapping using XML records:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# If necessary, click the '''General''' tab. The General tab appears.<br><span id="Figure 117-3"></span>''''' General Tab, XPath Options'''''<br>[[Image:dtxmlxpath.gif|General Tab, XPath Options]]<br><br><br><span id="'Figure 117-4"></span>'''' XPath Options for Composite Object Mappings'''''<br>[[Image:coxxmlpath.gif|XPath Options for Composite Object Mappings]]<br><br>
+
 
+
Click '''Browse''' and select the XPath to map to this attribute (see [[#Choosing the XPath|Choosing the XPath|Choosing the XPath]]).
+
 
+
For an EIS composite object mapping using XML records or an XML composite object mapping, you can choose one of the following:
+
* '''Specify XPath'''<nowiki>: select the XPath to map to this attribute (see </nowiki>[[#Choosing the XPath|Choosing the XPath]]).
+
* '''Aggregate into parent element'''<nowiki>: select the self XPath (</nowiki><tt>"."</tt>) (see [[Introduction%20to%20Mappings%20(ELUG)#Self XPath|Self XPath]]) so that the EclipseLink runtime performs all read and write operations in the parent's element, and not an element nested within it (see [[Introduction%20to%20Mappings%20(ELUG)#Mappings and the jaxb:class Customization|Mappings and the jaxb:class Customization]]).
+
 
+
 
+
 
+
 
+
 
+
====Choosing the XPath====
+
 
+
From the Choose XPath dialog box, select the XPath and click '''OK'''. Workbench builds the complete XPath name.
+
 
+
<br>
+
<span id="Figure 117-5 "></span>
+
'''''Choose XPath Dialog Box'''''
+
 
+
[[Image:choosexpath.gif|Choose XPath Dialog Box]]<br><br>
+
 
+
 
+
 
+
 
+
==Configuring a Default Null Value at the Mapping Level==
+
 
+
A default null value is the Java <tt>Object</tt> type and value that EclipseLink uses instead of <tt>null</tt> when EclipseLink reads a null value from a data source.
+
 
+
When you configure a default null value at the mapping level, EclipseLink uses it to translate in the following two directions:
+
 
+
* When EclipseLink reads <tt>null</tt> from the data source, it converts this <tt>null</tt> to the specified type and value.
+
* When EclipseLink writes or queries to the data source, it converts the specified type and value back to <tt>null</tt>.
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-6"></span>
+
''''' Mapping Support for Default Null Values'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Default Null Values" summary="This table summarizes which mappings support Default Null Values" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t9" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t9" align="left" valign="bottom" | '''[[#How to Configure a Default Null Value at the Mapping Level Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t9" align="left" valign="bottom" | '''[[#How to Configure a Default Null Value at the Mapping Level Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t9 r1c2-t9" align="left" | <br>
+
| headers="r2c1-t9 r1c3-t9" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-Field Mapping|Direct-to-Field Mapping]]<br>
+
| headers="r3c1-t9 r1c2-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t9 r1c3-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-XMLType Mapping|Direct-to-XMLType Mapping]]<br>
+
| headers="r4c1-t9 r1c2-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t9 r1c3-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r5c1-t9 r1c2-t9" align="left" | <br>
+
| headers="r5c1-t9 r1c3-t9" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r6c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r6c1-t9 r1c2-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t9 r1c3-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r7c1-t9 r1c2-t9" align="left" | <br>
+
| headers="r7c1-t9 r1c3-t9" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r8c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r8c1-t9 r1c2-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t9 r1c3-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t9" headers="r1c1-t9" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r9c1-t9 r1c2-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t9 r1c3-t9" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br><br>
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note'''<nowiki>:</nowiki> A default null value must be an <tt>Object</tt>. To specify a primitive value (such as <tt>int</tt>), you must use the corresponding <tt>Object</tt> wrapper (such as <tt>Integer</tt>).
+
|}
+
 
+
<br>
+
 
+
You can also use EclipseLink to set a default null value for all mappings used in a session (see [[Configuring%20a%20Data%20Source%20Login%20(ELUG)#Configuring a Default Null Value at the Login Level|Configuring a Default Null Value at the Login Level]]).
+
 
+
 
+
 
+
===How to Configure a Default Null Value at the Mapping Level Using Workbench===
+
To configure a default null value for a mapping, use this procedure.
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br>'''''General Tab, Default Null Value Options'''''<br>[[Image:mpdbgen2.gif|General Tab, Default Null Value Options]]<br><br>
+
# Complete the  '''Default Null Value''' fields  on the tab.
+
 
+
Use the following information to complete the '''Default Null Value''' fields on the tab:
+
{| class="HRuleInformal" dir="ltr" title="This table identifies the Default Null Value fields on the General tab of a mapping." summary="This table identifies the Default Null Value fields on the General tab of a mapping." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t11" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t11" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t11" headers="r1c1-t11" align="left" | '''Default Null Value'''
+
| headers="r2c1-t11 r1c2-t11" align="left" | Specify if this mapping contains a default value in the event that the data source is <tt>null</tt>. If selected, you must enter both the '''Type''' and '''Value''' of the default.
+
|- align="left" valign="top"
+
| id="r3c1-t11" headers="r1c1-t11" align="left" | '''Type'''
+
| headers="r3c1-t11 r1c2-t11" align="left" | Select the Java type of the default value.
+
|- align="left" valign="top"
+
| id="r4c1-t11" headers="r1c1-t11" align="left" | '''Value'''
+
| headers="r4c1-t11 r1c2-t11" align="left" | Enter the default value.
+
|}
+
 
+
 
+
 
+
 
+
 
+
 
+
===How to Configure a Default Null Value at the Mapping Level Using Java===
+
To configure a mapping null value using Java API, use the <tt>AbstractDirectMapping</tt> method <tt>setNullValue</tt>.
+
 
+
For example:
+
'''// Defaults a null salary to 0'''
+
salaryMapping.setNullValue(new Integer(0));
+
 
+
 
+
 
+
==Configuring Method or Direct Field Accessing at the Mapping Level==
+
By default, EclipseLink uses direct access to access public attributes. Alternatively, you can use getter and setter methods to access object attributes when writing the attributes of the object to the database, or reading the attributes of the object from the database. This is known as method access.
+
 
+
Using private, protected or package variable or method access requires you to enable the Java reflect security setting. This is enabled by default in most application servers (see [[Integrating%20EclipseLink%20with%20an%20Application%20Server%20(ELUG)#How to Set Security Permissions|How to Set Security Permissions]]), but may need to be enabled explicitly in certain JVM configurations. If necessary, use the <tt>java.policy</tt> file to grant <tt>ReflectPermission</tt> to the entire application or the application's code base. For example:
+
grant{
+
      permission java.lang.reflect.ReflectPermission;
+
};
+
 
+
We recommend using ''direct access'' whenever possible to improve performance and avoid executing any application-specific behavior while building objects.
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-7"></span>
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Method Accessing" summary="This table summarizes which mappings support method accessing" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t12" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t12" align="left" valign="bottom" | '''[[#How to Configure Method or Direct Field Accessing Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t12" align="left" valign="bottom" | '''[[#How to Configure Method or Direct Field Accessing Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t12" headers="r1c1-t12" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t12 r1c2-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r2c1-t12 r1c3-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r3c1-t12" headers="r1c1-t12" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r3c1-t12 r1c2-t12" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t12 r1c3-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t12" headers="r1c1-t12" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r4c1-t12 r1c2-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t12 r1c3-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t12" headers="r1c1-t12" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r5c1-t12 r1c2-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t12 r1c3-t12" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
For information on configuring method accessing at the project level, see [[Configuring%20a%20Project%20(ELUG)#Configuring Method or Direct Field Access at the Project Level|Configuring Method or Direct Field Access at the Project Level]].
+
 
+
If you enable change tracking on a property (for example, you decorate method <tt>getPhone</tt> with <tt>@ChangeTracking</tt>) and you access the field (<tt>phone</tt>) directly, note that EclipseLink does not detect the change. For more information, see [[EclipseLink%20Application%20Development%20(ELUG)#Using Method and Direct Field Access|Using Method and Direct Field Access]].
+
 
+
 
+
 
+
===How to Configure Method or Direct Field Accessing Using Workbench===
+
To complete the field access method for a mapping, use this procedure:
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-7"></span>''''' General Tab, Method Accessing Options'''''<br>[[Image:mpgen1.gif|General Tab, Method Accessing Options]]<br><br>
+
# Complete the '''Method Accessing''' fields on the tab.
+
 
+
Use the following information to complete the '''Method Accessing''' fields on this tab:
+
{| class="HRuleInformal" dir="ltr" title="This table identifies the Method Accessing fields on the General tab of a mapping." summary="This table identifies the Method Accessing fields on the General tab of a mapping." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t13" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t13" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t13" headers="r1c1-t13" align="left" | '''Method Accessing'''
+
| headers="r2c1-t13 r1c2-t13" align="left" | Specify if this mapping uses specific accessor methods instead directly accessing public attributes. By default, this option is not selected (that is, the mapping uses direct access).
+
|- align="left" valign="top"
+
| id="r3c1-t13" headers="r1c1-t13" align="left" | '''Get Method'''
+
| headers="r3c1-t13 r1c2-t13" align="left" | Select a specific <tt>get</tt> method.
+
|- align="left" valign="top"
+
| id="r4c1-t13" headers="r1c1-t13" align="left" | '''Set Method'''
+
| headers="r4c1-t13 r1c2-t13" align="left" | Select a specific <tt>set</tt> method.
+
|}
+
 
+
 
+
To change the default access type used by all new mappings, use the Defaults tab on the project Editor window. See [[Configuring%20a%20Project%20(ELUG)#Configuring Method or Direct Field Access at the Project Level|Configuring Method or Direct Field Access at the Project Level]] for more information.
+
 
+
'''See Also'''
+
: [[#Configuring Method or Direct Field Accessing at the Mapping Level|Configuring Method or Direct Field Accessing at the Mapping Level]]
+
: [[Introduction to EclipseLink%20Application%20Development%20(ELUG)#Using Method and Direct Field Access|Using Method and Direct Field Access]]
+
 
+
 
+
 
+
===How to Configure Method or Direct Field Accessing Using Java===
+
Use the following <tt>DatabaseMapping</tt> methods to configure the user-defined getters and setters that EclipseLink will use to access the mapped attribute:
+
 
+
For mappings not supported in Workbench, use the <tt>setGetMethodName</tt> and <tt>setSetMethodName</tt> methods to access the attribute through user-defined methods, rather than directly, as follows:
+
* <tt>setGetMethodName</tt>–set the <tt>String</tt> name of the user-defined method to get the mapped attribute;
+
* <tt>setSetMethodName</tt>–set the <tt>String</tt> name of the user-defined method to set the mapped attribute.
+
 
+
This example shows how to use these methods with a class that has an attribute <tt>phones</tt> and accessor methods <tt>getPhones</tt> and <tt>setPhones</tt> in an object-relational data type mapping.
+
 
+
 
+
<span id="Example 117-9"></span>
+
''''' Configuring Access Method in Java'''''
+
'''// Map the phones attribute'''
+
phonesMapping.setAttributeName("phones");
+
 
+
'''// Specify access method'''
+
phonesMapping.setGetMethodName("getPhones");
+
phonesMapping.setSetMethodName("setPhones");
+
 
+
 
+
 
+
==Configuring Private or Independent Relationships==
+
In EclipseLink, object relationships can be either private or independent:
+
* In a private relationship, the target object is a private component of the source object. The target object cannot exist without the source and is accessible only through the source object. Destroying the source object will also destroy the target object.
+
* In an independent relationship, the source and target objects are public ones that exist independently. Destroying one object does not necessarily imply the destruction of the other.
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Tip'''<nowiki>:</nowiki> EclipseLink automatically manages private relationships. Whenever an object is written to the database, any private objects it owns are also written to the database. When an object is removed from the database, any private objects it owns are also removed. Be aware of this when creating new systems, since it may affect both the behavior and the performance of your application.
+
|}
+
 
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-8"></span>
+
{| class="RuleFormalWideMax" dir="ltr" title="Mapping Support for Private or Independent Relationships" summary="This table summarizes which mappings support Private or Independent Relationships" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t15" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t15" align="left" valign="bottom" | '''Implicitly Private'''
+
! id="r1c3-t15" align="left" valign="bottom" | '''Private or Independent'''
+
! id="r1c4-t15" align="left" valign="bottom" | '''[[#How to Configure Private or Independent Relationships Using Workbench|Using Workbench]]<br>'''
+
! id="r1c5-t15" align="left" valign="bottom" | '''[[#How to Configure Private or Independent Relationships Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t15 r1c2-t15" align="left" | <br>
+
| headers="r2c1-t15 r1c3-t15" align="left" | <br>
+
| headers="r2c1-t15 r1c4-t15" align="left" | <br>
+
| headers="r2c1-t15 r1c5-t15" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-One Mapping|One-to-One Mapping]]<br>
+
| headers="r3c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r3c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Variable One-to-One Mapping|Variable One-to-One Mapping]]<br>
+
| headers="r4c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r4c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-Many Mapping|One-to-Many Mapping]]<br>
+
| headers="r5c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r5c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Many-to-Many Mapping|Many-to-Many Mapping]]<br>
+
| headers="r6c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r6c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Collection Mapping|Aggregate Collection Mapping]]<br>
+
| headers="r7c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r7c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r7c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Collection Mapping|Direct Collection Mapping]]<br>
+
| headers="r8c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r8c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r8c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Map Mapping|Direct Map Mapping]]<br>
+
| headers="r9c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Object Mapping|Aggregate Object Mapping]]<br>
+
| headers="r10c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r10c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r10c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r11c1-t15 r1c2-t15" align="left" | <br>
+
| headers="r11c1-t15 r1c3-t15" align="left" | <br>
+
| headers="r11c1-t15 r1c4-t15" align="left" | <br>
+
| headers="r11c1-t15 r1c5-t15" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r12c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Structure Mapping|Object-Relational Data Type Structure Mapping]]<br>
+
| headers="r12c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r12c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r12c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r12c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r13c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Reference Mapping|Object-Relational Data Type Reference Mapping]]<br>
+
| headers="r13c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r13c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r13c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r14c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Array Mapping|Object-Relational Data Type Array Mapping]]<br>
+
| headers="r14c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r14c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r14c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r15c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Object Array Mapping|Object-Relational Data Type Object Array Mapping]]<br>
+
| headers="r15c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r15c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r15c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r16c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Nested Table Mapping|Object-Relational Data Type Nested Table Mapping]]<br>
+
| headers="r16c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r16c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r16c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r16c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r17c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r17c1-t15 r1c2-t15" align="left" | <br>
+
| headers="r17c1-t15 r1c3-t15" align="left" | <br>
+
| headers="r17c1-t15 r1c4-t15" align="left" | <br>
+
| headers="r17c1-t15 r1c5-t15" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r18c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r18c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r18c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r18c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r19c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Object Mapping|EIS Composite Object Mapping]]<br>
+
| headers="r19c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r19c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r19c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r20c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Collection Mapping|EIS Composite Collection Mapping]]<br>
+
| headers="r20c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r20c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r20c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r20c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r21c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-One Mapping|EIS One-to-One Mapping]]<br>
+
| headers="r21c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r21c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r21c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r21c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r22c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-Many Mapping|EIS One-to-Many Mapping]]<br>
+
| headers="r22c1-t15 r1c2-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r22c1-t15 r1c3-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r22c1-t15 r1c4-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r22c1-t15 r1c5-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r23c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r23c1-t15 r1c2-t15" align="left" | <br>
+
| headers="r23c1-t15 r1c3-t15" align="left" | <br>
+
| headers="r23c1-t15 r1c4-t15" align="left" | <br>
+
| headers="r23c1-t15 r1c5-t15" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r24c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r24c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r24c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r24c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r24c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r25c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Object Mapping|XML Composite Object Mapping]]<br>
+
| headers="r25c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r25c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r25c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r25c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|- align="left" valign="top"
+
| id="r26c1-t15" headers="r1c1-t15" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Collection Mapping|XML Composite Collection Mapping]]<br>
+
| headers="r26c1-t15 r1c2-t15" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r26c1-t15 r1c3-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r26c1-t15 r1c4-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r26c1-t15 r1c5-t15" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure Private or Independent Relationships Using Workbench===
+
 
+
To create a privately owned mapping, use this procedure:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-8"></span>''''' General Tab, Private Owned option'''''<br>[[Image:oogenpri.gif|General Tab, Private Owned option]]<br><br>
+
#To create private ownership, select the '''Private Owned''' option.
+
 
+
 
+
 
+
 
+
===How to Configure Private or Independent Relationships Using Java===
+
 
+
For mappings not supported in the Workbench, use the <tt>independentRelationship</tt> (default), <tt>privateOwnedRelationship</tt>, and <tt>setIsPrivateOwned</tt> methods.
+
 
+
This exampple shows how to use these methods with a class that has a privately owned attribute, <tt>phones</tt>, in a mapping.
+
 
+
 
+
<span id="Example 117-10"></span>
+
''''' Configuring Access Method in Java'''''
+
'''// Map the phones attribute'''
+
phonesMapping.setAttributeName("phones");
+
 
+
'''// Specify as privately owned'''
+
phonesMapping.privateOwnedRelationship();
+
 
+
==Configuring Mapping Comments==
+
 
+
You can define a free-form textual comment for each mapping. You can use these comments however you wish: for example, to record important project implementation details such as the purpose or importance of a mapping.
+
 
+
Comments are stored in the Workbench project, in the EclipseLink deployment XML file. There is no Java API for this feature.
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-9"></span>
+
''''' Mapping Support for Comments'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Comments" summary="This table summarizes which mappings support Comments" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t16" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t16" align="left" valign="bottom" | '''[[#How to Configure Mapping Comments Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t16" align="left" valign="bottom" | '''How to Use Java'''
+
|- align="left" valign="top"
+
| id="r2c1-t16" headers="r1c1-t16" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t16 r1c2-t16" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r2c1-t16 r1c3-t16" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
|- align="left" valign="top"
+
| id="r3c1-t16" headers="r1c1-t16" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r3c1-t16 r1c2-t16" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t16 r1c3-t16" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t16" headers="r1c1-t16" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r4c1-t16 r1c2-t16" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t16 r1c3-t16" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure Mapping Comments Using Workbench===
+
 
+
To add a comment for a mapping, use this procedure.
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-9"></span>''''' General Tab, Comment'''''<br>[[Image:mpcomment.gif|General Tab, Comment]]<br><br>
+
#Enter a comment that describes this mapping.
+
 
+
 
+
 
+
==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 [[Introduction%20to%20Mappings%20(ELUG)#Serialized Object Converter|Serialized Object Converter]].
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-10"></span>
+
''''' Mapping Support for Serialized Object Converter'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Serialized Object Converter" summary="This table summarizes which mappings support Serialized Object Converter" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t17" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t17" align="left" valign="bottom" | '''[[#How to Configure a Serialized Object Converter Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t17" align="left" valign="bottom" | '''[[#How to Configure a Serialized Object Converter Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t17 r1c2-t17" align="left" | <br>
+
| headers="r2c1-t17 r1c3-t17" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-Field Mapping|Direct-to-Field Mapping]]<br>
+
| headers="r3c1-t17 r1c2-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r4c1-t17 r1c2-t17" align="left" | <br>
+
| headers="r4c1-t17 r1c3-t17" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r5c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Array Mapping|Object-Relational Data Type Array Mapping]]<br>
+
| headers="r5c1-t17 r1c2-t17" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r5c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r6c1-t17 r1c2-t17" align="left" | <br>
+
| headers="r6c1-t17 r1c3-t17" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r7c1-t17 r1c2-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r8c1-t17 r1c2-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r9c1-t17 r1c2-t17" align="left" | <br>
+
| headers="r9c1-t17 r1c3-t17" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r10c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r10c1-t17 r1c2-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t17" headers="r1c1-t17" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r11c1-t17 r1c2-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t17 r1c3-t17" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure a Serialized Object Converter Using Workbench===
+
 
+
To create an serialized object 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.<br>
+
 
+
 
+
<span id="Figure 117-10 "></span>'''''Converter Tab, Serialized Object Converter Option'''''<br>[[Image:convr_so.gif|Converter Tab, Serialized Object Converter Option]]<br><br>
+
#To specify a serialized object converter, select the '''Serialized Object Converter''' option.
+
 
+
===How to Configure a Serialized Object Converter Using Java===
+
 
+
You can set an <tt>org.eclipse.persistence.converters.SerializedObjectConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping</tt> or its subclasses using the <tt>AbstractCompositeDirectCollectionMapping</tt> method <tt>setValueConverter</tt>, as this example shows.
+
 
+
 
+
<span id="Example 117-11"></span>
+
''''' 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);
+
 
+
You can also set a <tt>SerializedObjectConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractDirectMapping</tt> or its subclasses using the <tt>AbstractDirectMapping</tt> method <tt>setConverter</tt>.
+
 
+
==Configuring a Type Conversion Converter==
+
 
+
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 [[Introduction%20to%20Mappings%20(ELUG)#Type Conversion Converter|Type Conversion Converter]].
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-11"></span>
+
''''' Mapping Support for Type Conversion Converter'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Type Conversion Converter" summary="This table summarizes which mappings support Type Conversion Converter" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t18" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t18" align="left" valign="bottom" | '''[[#How to Configure a Type Conversion Converter Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t18" align="left" valign="bottom" | '''[[#How to Configure a Type Conversion Converter Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t18 r1c2-t18" align="left" | <br>
+
| headers="r2c1-t18 r1c3-t18" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-Field Mapping|Direct-to-Field Mapping]]<br>
+
| headers="r3c1-t18 r1c2-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r4c1-t18 r1c2-t18" align="left" | <br>
+
| headers="r4c1-t18 r1c3-t18" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r5c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Array Mapping|Object-Relational Data Type Array Mapping]]<br>
+
| headers="r5c1-t18 r1c2-t18" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r5c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r6c1-t18 r1c2-t18" align="left" | <br>
+
| headers="r6c1-t18 r1c3-t18" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r7c1-t18 r1c2-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r8c1-t18 r1c2-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r9c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r9c1-t18 r1c2-t18" align="left" | <br>
+
| headers="r9c1-t18 r1c3-t18" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r10c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r10c1-t18 r1c2-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t18" headers="r1c1-t18" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r11c1-t18 r1c2-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t18 r1c3-t18" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure a Type Conversion Converter Using Workbench===
+
 
+
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.<br><span id="Figure 117-11"></span>''''' Converter Tab, Type Conversion Converter Option'''''<br>[[Image:convr_tc.gif|Converter Tab, Type Conversion Converter Option]]<br><br>
+
# Complete Type Conversion Converter fields on the Converter tab.
+
 
+
Use the following information to complete the Type Conversion Converter fields on the Converter tab:
+
 
+
{| class="Informal" dir="ltr" title="This table identifies the Type Conversion Converter fields on the General tab of a mapping." summary="This table identifies the Type Conversion Converter fields on the General tab of a mapping." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t19" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t19" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t19" headers="r1c1-t19" align="left" | '''Data Type'''
+
| headers="r2c1-t19 r1c2-t19" align="left" | Select the Java type of the data in the data source.
+
|- align="left" valign="top"
+
| id="r3c1-t19" headers="r1c1-t19" align="left" | '''Attribute Type'''
+
| headers="r3c1-t19 r1c2-t19" align="left" | Select the Java type of the attribute in the Java class.
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
 
+
 
+
===How to Configure a Type Conversion Converter Using Java===
+
 
+
You can set an <tt>org.eclipse.persistence.converters.TypeConversionConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping</tt> or its subclasses using the <tt>AbstractCompositeDirectCollectionMapping</tt> method <tt>setValueConverter</tt>, as this exmaple shows.
+
 
+
 
+
<span id="Example 117-12"></span>
+
''''' Configuring a TypeConversionConverter'''''
+
 
+
+
'''// Create TypeConversionConverter instance'''
+
TypeConversionConverter typeConversionConverter = new TypeConversionConverter();
+
typeConversionConverter.setDataClass(java.util.Calendar.class); 
+
typeConversionConverter.setObjectClass(java.sql.Date.class);
+
+
'''// Set TypeConversionConverter on ArrayMapping'''
+
ArrayMapping arrayMapping = new ArrayMapping();
+
arrayMapping.setValueConverter(typeConversionConverter);
+
arrayMapping.setAttributeName("date");
+
arrayMapping.setStructureName("Date_t");
+
arrayMapping.setFieldName("DATE");
+
orDescriptor.addMapping(arrayMapping);
+
 
+
You can also set a <tt>TypeConversionConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractDirectMapping</tt> or its subclasses using the <tt>AbstractDirectMapping</tt> method <tt>setConverter</tt>.
+
 
+
Configure the <tt>TypeConversionConverter</tt> instance using the following API:
+
 
+
* <tt>setDataClass(java.lang.Class dataClass)</tt>–to specify the data type class.
+
* <tt>setObjectClass(java.lang.Class objectClass)</tt>–to specify the object type class.
+
 
+
==Configuring an Object Type Converter==
+
 
+
An object type converter is used to match a fixed number of data source data values to Java object values. It can be used when the values in the data source and in Java differ.
+
 
+
For more information about the object type converter, see [[Introduction%20to%20Mappings%20(ELUG)#Object Type Converter|Object Type Converter]].
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-12"></span>
+
''''' Mapping Support for Object Type Converter'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Object Type Converter" summary="This table summarizes which mappings support Object Type Converter" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t20" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t20" align="left" valign="bottom" | '''[[#How to Configure an Object Type Converter Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t20" align="left" valign="bottom" | '''[[#How to Configure an Object Type Converter Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t20 r1c2-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r2c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r3c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r3c1-t20 r1c2-t20" align="left" | <br>
+
| headers="r3c1-t20 r1c3-t20" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r4c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Array Mapping|Object-Relational Data Type Array Mapping]]<br>
+
| headers="r4c1-t20 r1c2-t20" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r4c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r5c1-t20 r1c2-t20" align="left" | <br>
+
| headers="r5c1-t20 r1c3-t20" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r6c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r6c1-t20 r1c2-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r7c1-t20 r1c2-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r8c1-t20 r1c2-t20" align="left" | <br>
+
| headers="r8c1-t20 r1c3-t20" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r9c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r9c1-t20 r1c2-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t20" headers="r1c1-t20" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r10c1-t20 r1c2-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t20 r1c3-t20" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure an Object Type Converter Using Workbench===
+
 
+
To add an object type converter to a direct mapping, use this procedure:
+
 
+
# Select the mapping in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''Converter''' tab. The Converter tab appears.<br><span id="Figure 117-12"></span>''''' Converter Tab, Object Type Converter'''''<br>[[Image:convr_ot.gif|Converter Tab, Object Type Converter]]<br><br>
+
# Select the '''Object Type Converter''' option on the tab.
+
 
+
Use the following fields on the mapping's '''Converter''' tab to specify the object type converter options:
+
{| class="HRuleInformal" dir="ltr" title="This table identifies the Object Type Converter option on the Converter tab" summary="This table identifies the Object Type Converter option on the Converter tab" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t21" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t21" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t21" headers="r1c1-t21" align="left" | '''Data Type'''
+
| headers="r2c1-t21 r1c2-t21" align="left" | Select the Java type of the data in the data source.
+
|- align="left" valign="top"
+
| id="r3c1-t21" headers="r1c1-t21" align="left" | '''Attribute Type'''
+
| headers="r3c1-t21 r1c2-t21" align="left" | Select the Java type of the attribute in the Java class.
+
|- align="left" valign="top"
+
| id="r4c1-t21" headers="r1c1-t21" align="left" | '''Conversion Values'''
+
| headers="r4c1-t21 r1c2-t21" align="left" |
+
Click '''Add''' to add a new conversion value. Click '''Edit''' to modify an existing conversion value. Click '''Remove''' to delete an existing conversion value. Use to specify the selected value as the default value. If EclipseLink retrieves a value from the database that is not mapped as a valid Conversion Value, the default value will be used.
+
|- align="left" valign="top"
+
| id="r5c1-t21" headers="r1c1-t21" align="left" | ''' Data Value'''
+
| headers="r5c1-t21 r1c2-t21" align="left" | Specify the value of the attribute in the data source.
+
|- align="left" valign="top"
+
| id="r6c1-t21" headers="r1c1-t21" align="left" | ''' Attribute Value'''
+
| headers="r6c1-t21 r1c2-t21" align="left" | Specify the value of the attribute in the Java class
+
|- align="left" valign="top"
+
| id="r7c1-t21" headers="r1c1-t21" align="left" | ''' Default Attribute Value'''
+
| headers="r7c1-t21 r1c2-t21" align="left" | Specify whether or not to use the selected value as the default value. If EclipseLink retrieves a value from the database that is not mapped as a valid Conversion Value, the default value will be used.
+
|}
+
 
+
<br>
+
 
+
===How to Configure an Object Type Converter Using Java===
+
 
+
You can set an <tt>org.eclipse.persistence.converters.ObjectTypeConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping</tt> using <tt>AbstractCompositeDirectCollectionMapping</tt> method <tt>setValueConverter</tt>.
+
 
+
You can also set an <tt>ObjectTypeConverter</tt> on any instance of <tt>org.eclipse.persistence.mappings.foundation.AbstractDirectMapping</tt> or its subclasses using the <tt>AbstractDirectMapping</tt> method <tt>setConverter</tt>, as the following example shows.
+
 
+
 
+
<span id="Example 117-13"></span>
+
''''' Configuring an ObjectTypeConverter in Java'''''
+
'''// Create ObjectTypeConverter instance'''
+
ObjectTypeConverter objectTypeConvter = new ObjectTypeConverter();
+
objectTypeConverter.addConversionValue("F", "Female");
+
+
'''// Set ObjectTypeConverter on DirectToFieldMapping'''
+
DirectToFieldMapping genderMapping = new DirectToFieldMapping();
+
genderMapping.setConverter(objectTypeConverter);
+
genderMapping.setFieldName("F");
+
genderMapping.setAttributeName("Female");
+
descriptor.addMapping(genderMapping);
+
 
+
 
+
Configure the <tt>ObjectTypeConverter</tt> instance using the following API:
+
* <tt>addConversionValue(java.lang.Object fieldValue, java.lang.Object attributeValue)</tt>–to associate data-type values to object-type values.
+
* <tt>addToAttributeOnlyConversionValue(java.lang.Object fieldValue, java.lang.Object attributeValue)</tt>–to add one-way conversion values.
+
* <tt>setDefaultAttributeValue(java.lang.Object defaultAttributeValue)</tt>–to set the default value.
+
 
+
==Configuring a Simple Type Translator==
+
 
+
The simple type translator allows you to automatically translate an XML element value to an appropriate Java type based on the element's <tt><type></tt> attribute, as defined in your XML schema. You can use a simple type translator only when the mapping's XPath goes to an element. You cannot use a simple type translator if the mapping's XPath goes to an attribute.
+
 
+
For more information, see [[Introduction%20to%20Mappings%20(ELUG)#Simple Type Translator|Simple Type Translator]].
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-13"><span>
+
''''' Mapping Support for Simple Type Translator'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Simple Type Translator" summary="This table summarizes which mappings support Simple Type Translator" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t22" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t22" align="left" valign="bottom" | '''[[#How to Configure a Simple Type Translator Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t22" align="left" valign="bottom" | '''[[#How to Configure a Simple Type Translator Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r2c1-t22 r1c2-t22" align="left" | <br>
+
| headers="r2c1-t22 r1c3-t22" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r3c1-t22 r1c2-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t22 r1c3-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r4c1-t22 r1c2-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t22 r1c3-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r5c1-t22 r1c2-t22" align="left" | <br>
+
| headers="r5c1-t22 r1c3-t22" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r6c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r6c1-t22 r1c2-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t22 r1c3-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t22" headers="r1c1-t22" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r7c1-t22 r1c2-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t22 r1c3-t22" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure a Simple Type Translator Using Workbench===
+
 
+
Use this table to qualify elements from the XML schema
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-13"></span>''''' General Tab, Use XML Schema "type" Attribute Option'''''<br>[[Image:xmlschtyp.gif|General Tab, Use XML Schema "type" Attribute Option]]<br><br>
+
#Select the '''Field Uses XML Schema "type" attribute''' field to qualify elements from the XML schema.
+
 
+
 
+
 
+
 
+
===How to Configure a Simple Type Translator Using Java===
+
 
+
To create an XML mapping with a simple type translator with Java code in your IDE, you need the following elements:
+
 
+
* <tt>EISDirectMapping</tt> or <tt>EISCompositeDirectCollectionMapping</tt> or <tt>XMLDirectMapping</tt> or <tt>XMLCompositeDirectCollectionMapping</tt>
+
* instance of <tt>Converter</tt>
+
* instance of <tt>TypedElementField</tt>
+
 
+
This example shows how to implement your own simple type translator with an <tt>XMLDirectMapping</tt> to override the built-in conversion for writing XML so that EclipseLink writes a <tt>Byte</tt> array (<tt>ClassConstants.ABYTE</tt>) as a <tt>Base64</tt> (<tt>XMLConstants.BASE64_BINARY</tt>) encoded string.
+
 
+
 
+
<span id="Example 117-14"></span>
+
''''' Creating a Type Translation XML Mapping'''''
+
XMLDirectMapping mapping = new XMLDirectMapping();
+
mapping.setConverter(new SerializedObjectConverter());
+
TypedElementField field = new TypedElementField("element");
+
field.getSimpleTypeTranslator().addJavaConversion(
+
                          ClassConstants.ABYTE,
+
                          new QName(XMLConstants.SCHEMA_URL, XMLConstants.BASE64_BINARY));
+
mapping.setField(field);
+
 
+
==Configuring a JAXB Typesafe Enumeration Converter==
+
 
+
The JAXB typesafe enumeration converter allows you to automatically translate an XML element value to an appropriate typesafe enumeration value as defined in your XML schema.
+
 
+
For more information, see [[Introduction%20to%20Mappings%20(ELUG)#Mappings and JAXB Typesafe Enumerations|Mappings and JAXB Typesafe Enumerations]].
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="'Table 117-14"></span>
+
''''Mapping Support for JAXB Typesafe Enumeration Converter'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for JAXB Typesafe Enumeration Converter" summary="This table summarizes which mappings support for JAXB Typesafe Enumeration Converter" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t23" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t23" align="left" valign="bottom" | '''How to Use Workbench'''
+
! id="r1c3-t23" align="left" valign="bottom" | '''[[#How to Configure a JAXB Typesafe Enumeration Converter Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]] <sup>Foot 1 </sup>
+
| headers="r2c1-t23 r1c2-t23" align="left" | <br>
+
| headers="r2c1-t23 r1c3-t23" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r3c1-t23 r1c2-t23" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t23 r1c3-t23" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r4c1-t23 r1c2-t23" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r4c1-t23 r1c3-t23" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r5c1-t23 r1c2-t23" align="left" | <br>
+
| headers="r5c1-t23 r1c3-t23" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r6c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r6c1-t23 r1c2-t23" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r6c1-t23 r1c3-t23" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t23" headers="r1c1-t23" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r7c1-t23 r1c2-t23" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r7c1-t23 r1c3-t23" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br><sup>Footnote 1 </sup>When used with XML records only (see [[Configuring%20an%20EIS%20Descriptor%20(ELUG)#Configuring Record Format|Configuring Record Format]]).<br>
+
 
+
The Workbench does not support the <tt>JAXBTypesafeEnumConverter</tt> directly: to configure a mapping with this converter, you must use Java to create an amendment method (see [[#How to Configure a JAXB Typesafe Enumeration Converter Using Java|Using Java]]).
+
 
+
If you create a project and object model using the EclipseLink JAXB compiler (see [[Creating%20an%20XML%20Project%20(ELUG)#Creating an XML Project from an XML Schema|Creating an XML Project from an XML Schema]]), the compiler will create the type safe enumeration class and a class with descriptor amendment methods and register the required amendment methods automatically (see [[Introduction%20to%20XML%20Projects%20(ELUG)#Typesafe Enumeration Converter Amendment Method DescriptorAfterLoads Class|Typesafe Enumeration Converter Amendment Method DescriptorAfterLoads Class]]).
+
 
+
 
+
 
+
===How to Configure a JAXB Typesafe Enumeration Converter Using Java===
+
 
+
To configure a mapping with a <tt>JAXBTypesafeEnumConverter</tt> in Java, use a descriptor amendment method (see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Amendment Methods|Configuring Amendment Methods]]). This example illustrates an amendment method that configures an <tt>XMLDirectMapping</tt> with a <tt>JAXBTypesafeEnumConverter</tt>. In this example, attribute <tt>_Val</tt> is mapped to a JAXB typesafe enumeration corresponding to typesafe enumeration class <tt>MyTypesafeEnum</tt>.
+
 
+
 
+
<span id="Example 117-15"></span>
+
'''''Creating a JAXB Typesafe Enumeration XML Mapping'''''
+
public class DescriptorAfterLoads {
+
+
    public static void amendRootImplDescriptor(ClassDescriptor descriptor) {
+
        DatabaseMapping _ValMapping = descriptor.getMappingForAttributeName("_Val");
+
        JAXBTypesafeEnumConverter _ValConverter = new JAXBTypesafeEnumConverter();
+
        ValConverter.setEnumClassName("MyTypesafeEnum");
+
        ((XMLDirectMapping) _ValMapping).setConverter(_ValConverter);
+
    }
+
}
+
 
+
 
+
 
+
 
+
==Configuring Container Policy==
+
 
+
Collection mapping container policy specifies the concrete class EclipseLink should use when reading target objects from the database.
+
 
+
Collection mappings can use any concrete class that implements the <tt>java.util.List</tt>, <tt>java.util.Set</tt>, <tt>java.util.Collection</tt>, or <tt>java.util.Map</tt> interface. You can map object attributes declared as <tt>List</tt>, <tt>Set</tt>, <tt>Collection</tt>, <tt>Map</tt>, or any subinterface of these interfaces, or as a class that implements one of these interfaces.
+
 
+
By default, the EclipseLink runtime uses the following concrete classes from the <tt>org.eclipse.persistence.indirection</tt> package for each of these container types:
+
 
+
* <tt>List</tt>–<tt>IndirectList</tt> or <tt>Vector</tt>
+
* <tt>Set</tt>–<tt>IndirectSet</tt> or <tt>HashSet</tt>
+
* <tt>Collection</tt>–<tt>IndirectList</tt> or <tt>Vector</tt>
+
* <tt>Map</tt>–<tt>IndirectMap</tt> or <tt>HashSet</tt>
+
 
+
Alternatively, you can specify in the mapping the concrete container class to be used. When EclipseLink reads objects from the database that contain an attribute mapped with a collection mapping, the attribute is set with an instance of the concrete class specified. For example, EclipseLink does not sort in memory. If you want to sort in memory, override the default <tt>Set</tt> type (<tt>IndirectList</tt>) with <tt>java.util.TreeSet</tt> as the concrete collection type. By default, a collection mapping's container class is <tt>java.util.Vector</tt>.
+
 
+
<br>
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note:''' If you are using Workbench and you override the default <tt>Collection</tt> class with a custom <tt>Collection</tt> class of your own, you must put your custom <tt>Collection</tt> class on the Workbench classpath (see [[Using%20Workbench%20(ELUG)#Configuring the Workbench Environment|Configuring the Workbench Environment]]).
+
|}
+
 
+
<br>
+
 
+
This table summarizes which mappings support this option.
+
 
+
<span id="Table 117-15"></span>
+
''''' Mapping Support for Container Policy'''''
+
 
+
{| class="RuleFormalWideMax" dir="ltr" title="Mapping Support for Container Policy" summary="This table summarizes which mappings support Container Policy" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t25" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t25" align="left" valign="bottom" | '''List'''
+
! id="r1c3-t25" align="left" valign="bottom" | '''Set'''
+
! id="r1c4-t25" align="left" valign="bottom" | '''Collection'''
+
! id="r1c5-t25" align="left" valign="bottom" | '''Map'''
+
! id="r1c6-t25" align="left" valign="bottom" | '''[[#How to Configure Container Policy Using Workbench|Using Workbench]]<br>'''
+
! id="r1c7-t25" align="left" valign="bottom" | '''[[#How to Configure Container Policy Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t25 r1c2-t25" align="left" | <br>
+
| headers="r2c1-t25 r1c3-t25" align="left" | <br>
+
| headers="r2c1-t25 r1c4-t25" align="left" | <br>
+
| headers="r2c1-t25 r1c5-t25" align="left" | <br>
+
| headers="r2c1-t25 r1c6-t25" align="left" | <br>
+
| headers="r2c1-t25 r1c7-t25" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-Many Mapping|One-to-Many Mapping]]<br>
+
| headers="r3c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Many-to-Many Mapping|Many-to-Many Mapping]]<br>
+
| headers="r4c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Collection Mapping|Aggregate Collection Mapping]]<br>
+
| headers="r5c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t25 r1c6-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r5c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Collection Mapping|Direct Collection Mapping]]<br>
+
| headers="r6c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t25 r1c5-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r6c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r6c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct Map Mapping|Direct Map Mapping]]<br>
+
| headers="r7c1-t25 r1c2-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r7c1-t25 r1c3-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r7c1-t25 r1c4-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r7c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Object-Relational Data Type Mappings|Object-Relational Data Type Mappings]]<br>
+
| headers="r8c1-t25 r1c2-t25" align="left" | <br>
+
| headers="r8c1-t25 r1c3-t25" align="left" | <br>
+
| headers="r8c1-t25 r1c4-t25" align="left" | <br>
+
| headers="r8c1-t25 r1c5-t25" align="left" | <br>
+
| headers="r8c1-t25 r1c6-t25" align="left" | <br>
+
| headers="r8c1-t25 r1c7-t25" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r9c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Array Mapping|Object-Relational Data Type Array Mapping]]<br>
+
| headers="r9c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r9c1-t25 r1c6-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r9c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r10c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Object Array Mapping|Object-Relational Data Type Object Array Mapping]]<br>
+
| headers="r10c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r10c1-t25 r1c6-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r10c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r11c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Object-Relational%20Data%20Type%20Mappings%20(ELUG)#Object-Relational Data Type Nested Table Mapping|Object-Relational Data Type Nested Table Mapping]]<br>
+
| headers="r11c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r11c1-t25 r1c6-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r11c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r12c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r12c1-t25 r1c2-t25" align="left" | <br>
+
| headers="r12c1-t25 r1c3-t25" align="left" | <br>
+
| headers="r12c1-t25 r1c4-t25" align="left" | <br>
+
| headers="r12c1-t25 r1c5-t25" align="left" | <br>
+
| headers="r12c1-t25 r1c6-t25" align="left" | <br>
+
| headers="r12c1-t25 r1c7-t25" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r13c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r13c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t25 r1c5-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r13c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r13c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r14c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Collection Mapping|EIS Composite Collection Mapping]]<br>
+
| headers="r14c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r14c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r15c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-Many Mapping|EIS One-to-Many Mapping]]<br>
+
| headers="r15c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r15c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r16c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r16c1-t25 r1c2-t25" align="left" | <br>
+
| headers="r16c1-t25 r1c3-t25" align="left" | <br>
+
| headers="r16c1-t25 r1c4-t25" align="left" | <br>
+
| headers="r16c1-t25 r1c5-t25" align="left" | <br>
+
| headers="r16c1-t25 r1c6-t25" align="left" | <br>
+
| headers="r16c1-t25 r1c7-t25" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r17c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r17c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t25 r1c5-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r17c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r17c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r18c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Collection Mapping|XML Composite Collection Mapping]]<br>
+
| headers="r18c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t25 r1c5-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r18c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r19c1-t25" headers="r1c1-t25" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Any Collection Mapping|XML Any Collection Mapping]]]
+
| headers="r19c1-t25 r1c2-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t25 r1c3-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t25 r1c4-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t25 r1c5-t25" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r19c1-t25 r1c6-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r19c1-t25 r1c7-t25" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure Container Policy Using Workbench===
+
 
+
To specify a mapping's container policy, use this procedure:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.
+
# Click the '''Advanced''' button. The Advanced Container Options appear on the General tab.<br><span id="Figure 117-14"></span>''''' General Tab, Advanced Container Options'''''<br>[[Image:onetomany_coll_cont.gif|General Tab, Advanced Container Options]]<br><br>
+
# Complete '''Advanced Container Options''' on the tab.
+
 
+
Use the following Advanced Container Options fields on the '''General''' tab to specify the container options:
+
 
+
{| class="HRuleInformal" dir="ltr" title="This table identifies Advanced Container Options fields on the General tab" summary="This table identifies Advanced Container Options fields on the General tab" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t26" align="left" valign="bottom" | '''Field <sup>Foot 1 </sup>'''
+
! id="r1c2-t26" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t26" headers="r1c1-t26" align="left" | '''Container Type'''
+
| headers="r2c1-t26 r1c2-t26" align="left" |
+
Specify the type of <tt>Collection</tt> class to use:
+
* '''List'''–use a <tt>java.util.List</tt>
+
* '''Set'''–use a <tt>java.util.Set</tt>
+
* '''Collection'''–use a <tt>java.util.Collection</tt>
+
* '''Map'''–use a <tt>java.util.Map</tt>
+
|- align="left" valign="top"
+
| id="r3c1-t26" headers="r1c1-t26" align="left" | '''Override Default Class'''
+
| headers="r3c1-t26 r1c2-t26" align="left" | Specify to use a custom class as the mapping's container policy. Click '''Browse''' to select a different class. The container class must implement (directly or indirectly) the <tt>java.util.Collection</tt> interface.
+
|- align="left" valign="top"
+
| id="r4c1-t26" headers="r1c1-t26" align="left" | '''Key Method'''
+
| headers="r4c1-t26 r1c2-t26" align="left" | If you configure '''Container Type''' as '''Map''', use this option to specify the name of the zero argument method whose result, when called on the target object, is used as the key in the <tt>Hashtable</tt> or <tt>Map</tt>. This method must return an object that is a valid key in the <tt>Hashtable</tt> or <tt>Map</tt>.
+
|}
+
 
+
<br><sup>Footnote 1 </sup>Not all mappings support all options. For more information, see the [[#Table 117-15|Mapping Support for Container Policy]] table.<br>
+
 
+
 
+
 
+
 
+
===How to Configure Container Policy Using Java===
+
 
+
Classes that implement the <tt>org.eclipse.persistence.mappings.ContainerMapping</tt> interface provide the following methods to set the container policy:
+
 
+
* <tt>useCollectionClass(java.lang.Class concreteClass)</tt>–Configure the mapping to use an instance of the specified <tt>java.util.Collection</tt> container class to hold the target objects.
+
* <tt>useMapClass(java.lang.Class concreteClass, java.lang.String methodName)</tt>–Configure the mapping to use an instance of the specified <tt>java.util.Map</tt> container class to hold the target objects. The key used to index a value in the <tt>Map</tt> is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of any value to be inserted into the <tt>Map</tt>.
+
 
+
Classes that extend <tt>org.eclipse.persistence.mappings.CollectionMapping</tt> (which implements the <tt>ContainerMapping</tt> interface) also provide the following methods to set the container policy:
+
 
+
* <tt>useSortedSetClass(java.lang.Class concreteClass, java.util.Comparator comparator)</tt>–Configure the mapping to use an instance of the specified <tt>java.util.SortedSet</tt> container class. Specify the <tt>Comparator</tt> to use to sort the target objects.
+
 
+
The following example shows how to configure a <tt>DirectCollectionMapping</tt> to use a <tt>java.util.ArrayList</tt> container class.
+
 
+
 
+
<span id="'Example 117-16"></span>
+
''''' Direct Collection Mapping'''''
+
'''// Create a new mapping and register it with the source descriptor'''
+
DirectCollectionMappingphonesMapping = new DirectCollectionMapping();
+
phonesMapping.setAttributeName("phones");
+
phonesMapping.setGetMethodName("getPhones");
+
phonesMapping.setSetMethodName("setPhones");
+
phonesMapping.setReferenceTableName("PHONES_TB");
+
phonesMapping.setDirectFieldName("PHONES");
+
phonesMapping.useCollectionClass(ArrayList.class); '''// set container policy'''
+
descriptor.addMapping(phonesMapping);
+
 
+
 
+
==Configuring Attribute Transformer==
+
A transformation mapping is made up of an attribute transformer for field-to-attribute transformation at read (unmarshall) time and one or more field transformers for attribute-to-field transformation at write (marshall) time (see [[#Configuring Field Transformer Associations|Configuring Field Transformer Associations]]).
+
 
+
This section describes how to configure the attribute transformer that a transformation mapping uses to perform the field-to-attribute transformation at read (unmarshal) time.
+
 
+
You can do this using either a method or class-based transformer.
+
 
+
A method-based transformer must map to a method in the domain object.
+
 
+
A class-based transformer allows you to place the transformation code in another class, making this approach non-intrusive: that is, your domain object does not need to implement a EclipseLink interface or provide a special transformation method
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-16"></span>
+
''''' Mapping Support for Attribute Transformer'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Attribute Transformer" summary="This table summarizes which mappings support Attribute Transformer" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t27" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t27" align="left" valign="bottom" | '''[[#How to Configure Attribute Transformer Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t27" align="left" valign="bottom" | '''[[#How to Configure Attribute Transformer Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t27 r1c2-t27" align="left" | <br>
+
| headers="r2c1-t27 r1c3-t27" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Transformation Mapping|Transformation Mapping]]<br>
+
| headers="r3c1-t27 r1c2-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t27 r1c3-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r4c1-t27 r1c2-t27" align="left" | <br>
+
| headers="r4c1-t27 r1c3-t27" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r5c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Transformation Mapping| EIS Transformation Mapping]]<br>
+
| headers="r5c1-t27 r1c2-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t27 r1c3-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r6c1-t27 r1c2-t27" align="left" | <br>
+
| headers="r6c1-t27 r1c3-t27" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t27" headers="r1c1-t27" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Transformation Mapping|XML Transformation Mapping]]<br>
+
| headers="r7c1-t27 r1c2-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t27 r1c3-t27" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure Attribute Transformer Using Workbench===
+
 
+
To specify a mapping's attribute transformer, use this procedure:
+
 
+
# Select the transformation mapping in the '''Navigator'''. Its properties appear in the Editor.<br><span id="Figure 117-15"></span>''''' Transformation Mapping, Attribute Transformer Field'''''<br>[[Image:trmapatt.gif|Transformation Mapping, Attribute Transformer Field]]<br><br>
+
# Click '''Edit'''. The Specify Transformer dialog box appears.<br><span id="'Figure 117-16"></span>''''' Specify Transformer Dialog Box'''''<br>[[Image:spstrans.gif|Specify Transformer Dialog Box]]<br><br>
+
# Complete each field on the Specify Transformer dialog box and click '''OK'''.
+
 
+
Use the following information to enter data in each field of the dialog box and click '''OK'''<nowiki>:</nowiki>
+
{| class="HRuleInformal" dir="ltr" title="This table identifies the options on the Specify Transformer dialog" summary="This table identifies the options on the Specify Transformer dialog" width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t28" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t28" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t28" headers="r1c1-t28" align="left" | '''Use Transformation Method'''
+
| headers="r2c1-t28 r1c2-t28" align="left" | Select a specific method to control the transformation. A method based transformer must map to a method in the domain object.
+
|- align="left" valign="top"
+
| id="r3c1-t28" headers="r1c1-t28" align="left" | '''Use Transformer Class'''
+
| headers="r3c1-t28 r1c2-t28" align="left" | Select a specific class to control the transformation. The class must be available on the Workbench application classpath.
+
|}
+
 
+
<br>
+
 
+
===How to Configure Attribute Transformer Using Java===
+
 
+
You can configure a method-based attribute transformer using <tt>AbstractTransformationMapping</tt> method <tt>setAttributeTransformation</tt>, passing in the name of the domain object method to use.
+
 
+
You can configure a class-based attribute transformer using <tt>AbstractTransformationMapping</tt> method <tt>setAttributeTransformer</tt>, passing in an instance of <tt>org.eclipse.persistence.mappings.Transfomers.AttributeTransformer</tt>.
+
 
+
A convenient way to create an <tt>AttributeTransformer</tt> is to extend <tt>AttributeTransformerAdapter</tt>.
+
 
+
 
+
 
+
==Configuring Field Transformer Associations==
+
A transformation mapping is made up of an attribute transformer for field-to-attribute transformation at read (unmarshall) time (see [[#Configuring Attribute Transformer|Configuring Attribute Transformer]]) and one or more field transformers for attribute-to-field transformation at write (marshall) time.
+
 
+
This section describes how to configure the field transformers that a transformation mapping uses to perform the object attribute-to-field transformation at write (marshal) time.
+
 
+
You can do this using either a method or class-based transformer.
+
 
+
A method-based transformer must map to a method in the domain object.
+
 
+
A class-based transformer allows you to place the transformation code in another class, making this approach non-intrusive: that is, your domain object does not need to implement a EclipseLink interface or provide a special transformation method.
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-17"></span>
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Field Transformer" summary="This table summarizes which mappings support Field Transformer" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t29" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t29" align="left" valign="bottom" | '''[[#How to Configure Field Transformer Associations Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t29" align="left" valign="bottom" | '''[[#How to Configure Field Transformer Associations Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t29 r1c2-t29" align="left" | <br>
+
| headers="r2c1-t29 r1c3-t29" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Transformation Mapping|Transformation Mapping]]<br>
+
| headers="r3c1-t29 r1c2-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t29 r1c3-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r4c1-t29 r1c2-t29" align="left" | <br>
+
| headers="r4c1-t29 r1c3-t29" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r5c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Transformation Mapping| EIS Transformation Mapping]]<br>
+
| headers="r5c1-t29 r1c2-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t29 r1c3-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r6c1-t29 r1c2-t29" align="left" | <br>
+
| headers="r6c1-t29 r1c3-t29" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t29" headers="r1c1-t29" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Transformation Mapping|XML Transformation Mapping]]<br>
+
| headers="r7c1-t29 r1c2-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t29 r1c3-t29" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure Field Transformer Associations Using Workbench===
+
 
+
Use this procedure to complete the '''Object->Field Method''' fields:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.<br><span id="Figure 117-17"></span>''''' Transformation Mapping, Field Transformer Associations'''''<br>[[Image:trmapfie.gif|Transformation Mapping, Field Transformer Associations]]<br><br>
+
# Click '''Add''' to add the necessary Field Transformer Associations for the mapping.
+
 
+
To add a new association, click '''Add'''. Continue with [[#Specifying Field-to-Transformer Associations|Specifying Field-to-Transformer Associations]].
+
 
+
To change an existing association, click '''Edit'''. Continue with [[#Specifying Field-to-Transformer Associations|Specifying Field-to-Transformer Associations]].
+
 
+
To delete an existing association, select the field transformation association and click '''Delete'''.
+
 
+
 
+
 
+
 
+
 
+
====Specifying Field-to-Transformer Associations====
+
 
+
To specify the actual transformation method or class used for the field of a transformation mapping, use this procedure.
+
 
+
# From the Transformation Mapping, Field Transformer Associations, click '''Add''' or Edit. The Specify Field-Transformer Association dialog box appears.<br><span id="Figure 117-18"></span>''''' Specify Field-Transformer Association Dialog Box'''''<br>[[Image:fldtramt.gif|Specify Field-Transformer Association Dialog Box]]<br><br>
+
# Complete each [topicid:dialog.editTransformer field on the dialog box].
+
 
+
Use the following information to complete each field on the dialog box:
+
{| class="HRuleInformal" dir="ltr" title="This table identifies each field on the Specify Field-Transformer Association dialog." summary="This table identifies each field on the Specify Field-Transformer Association dialog." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t30" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t30" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t30" headers="r1c1-t30" align="left" | '''Field'''
+
| headers="r2c1-t30 r1c2-t30" align="left" | Select the database field (from the descriptor's associated table) for this transformation.
+
|- align="left" valign="top"
+
| id="r3c1-t30" headers="r1c1-t30" align="left" | '''Transformer'''
+
| headers="r3c1-t30 r1c2-t30" align="left" | Select one of the following methods to control the transformation:
+
|- align="left" valign="top"
+
| id="r4c1-t30" headers="r1c1-t30" align="left" | '''Use Transformation Method'''
+
| headers="r4c1-t30 r1c2-t30" align="left" | Select a specific method to control the transformation. A method based transformer must map to a method in the domain object.
+
|- align="left" valign="top"
+
| id="r5c1-t30" headers="r1c1-t30" align="left" | '''Use Transformer Class'''
+
| headers="r5c1-t30 r1c2-t30" align="left" | Select a specific class to control the transformation. The class must be available on Workbench application classpath.
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
 
+
 
+
===How to Configure Field Transformer Associations Using Java===
+
 
+
You can specify a specific transformation method on your domain object or an instance of <tt>org.eclipse.persistence.mappings.Transfomers.FieldTransformer</tt> (you can also extend the <tt>FieldTransformerAdapter</tt>). Using a <tt>FieldTransformer</tt> is non-intrusive: that is, your domain object does not need to implement a EclipseLink interface or provide a special transformation method.
+
 
+
You can configure a method-based field transformer using <tt>AbstractTransformationMapping</tt> method <tt>addFieldTransformation</tt>, passing in the name of the database field and the name of the domain object method to use.
+
 
+
You can configure a class-based field transformer using <tt>AbstractTransformationMapping</tt> method <tt>addFieldTransformer</tt>, passing in the name of the database field and an instance of <tt>org.eclipse.persistence.mappings.Transfomers.FieldTransformer</tt>.
+
 
+
A convenient way to create a <tt>FieldTransformer</tt> is to extend <tt>FieldTransformerAdapter</tt>.
+
 
+
 
+
 
+
 
+
==Configuring Mutable Mappings==
+
 
+
Direct mappings typically map simple, nonmutable values such as <tt>String</tt> or <tt>Integer</tt>. Transformation mappings can potentially map complex mutable object values, such as mapping several database field values to an instance of a Java class.
+
 
+
If a transformation mapping maps a mutable value, EclipseLink must clone and compare the value in a unit of work (see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Copy Policy|Configuring Copy Policy]]).
+
 
+
By default, EclipseLink assumes that all transformation mappings are mutable. If the mapping maps a simple immutable value, you can improve the unit of work performance by configuring the '''IsMutable''' option to <tt>false</tt>.
+
 
+
By default, EclipseLink also assumes that all direct mappings are mutable unless a serialized converter is used. These mappings can also set the '''IsMutable''' option. You should set it if you want to modify <tt>Date</tt> or <tt>Calendar</tt> fields. 
+
 
+
This table summarizes which mappings support this option.
+
 
+
For more information, see [[Introduction to EclipseLink%20Application%20Development%20(ELUG)#Mutability|Mutability]].
+
 
+
 
+
<span id="Table 117-18"></span>
+
''''' Mapping Support for Mutable Mappings'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Mutable Mappings" summary="This table summarizes which mappings support Mutable Mappings" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t31" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t31" align="left" valign="bottom" | '''[[#How to Configure Mutable Mappings Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t31" align="left" valign="bottom" | '''How to Use Java'''
+
|- align="left" valign="top"
+
| id="r2c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t31 r1c2-t31" align="left" | <br>
+
| headers="r2c1-t31 r1c3-t31" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Transformation Mapping|Transformation Mapping]]<br>
+
| headers="r3c1-t31 r1c2-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r3c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-Field Mapping|Direct-to-Field Mapping]]<br>
+
| headers="r3c1-t31 r1c2-t31" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r3c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r4c1-t31 r1c2-t31" align="left" | <br>
+
| headers="r4c1-t31 r1c3-t31" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r5c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Transformation Mapping| EIS Transformation Mapping]]<br>
+
| headers="r5c1-t31 r1c2-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping| EIS Direct Mapping]]<br>
+
| headers="r5c1-t31 r1c2-t31" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r5c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r6c1-t31 r1c2-t31" align="left" | <br>
+
| headers="r6c1-t31 r1c3-t31" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Transformation Mapping|XML Transformation Mapping]]<br>
+
| headers="r7c1-t31 r1c2-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t31" headers="r1c1-t31" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r7c1-t31 r1c2-t31" align="left" |
+
[[Image:unsupport.gif|Unsupported.]]<br>
+
| headers="r7c1-t31 r1c3-t31" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
===How to Configure Mutable Mappings Using Workbench===
+
 
+
Use this table to complete the '''Object->Field Method''' fields:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.<br><span id="'Figure 117-19"></span>'''' Transformation Mapping, Mutable Option'''''<br>[[Image:trmute.gif|Transformation Mapping, Mutable Option]]<br><br>
+
#By default, the '''IsMutable''' option is selected in all transformation mappings. If the mapping maps to a simple atomic value, unselect this option.
+
 
+
 
+
 
+
 
+
===How to Configure Mutable Mappings Using Java===
+
 
+
You can specify whether or not a mapping is mutable using <tt>AbstractTransformationMapping</tt> method <tt>setIsMutable</tt> for transformation mappings, and <tt>AbstractDirectMapping</tt> method <tt>isMutable</tt> for direct mappings.
+
 
+
==Configuring Bidirectional Relationship==
+
 
+
EclipseLink can automatically manage the bidirectional relationship: if one side of the relationship is set or modified, EclipseLink will automatically set the other side. To enable this functionality, use the value holder indirection (see [[Introduction%20to%20Mappings%20(ELUG)#Value Holder Indirection|Value Holder Indirection]]) for one-to-one mappings, and transparent collections (see [[Introduction%20to%20Mappings%20(ELUG)#Transparent Indirect Container Indirection|Transparent Indirect Container Indirection]])–for one-to-many and many-to-many mappings.
+
 
+
<br>
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note'''<nowiki>:</nowiki> We do not recommend using this EclipseLink feature: if the object model is used outside the persistence context it must be responsible for managing the bidirectional relationship.
+
 
+
Instead, your application should maintain the bidirectional relationship in its getter and setter methods.
+
|}
+
 
+
<br>
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-19"></span>
+
''''' Mapping Support for Mutable Mappings'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Mutable Mappings" summary="This table summarizes which mappings support Mutable Mappings" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t33" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t33" align="left" valign="bottom" | '''[[#How to Configure Bidirectional Relationship Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t33" align="left" valign="bottom" | '''[[#How to Configure Bidirectional Relationship Using Java|Using Java]]'''
+
|- align="left" valign="top"
+
| id="r2c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#Relational Mappings|Relational Mappings]]<br>
+
| headers="r2c1-t33 r1c2-t33" align="left" | <br>
+
| headers="r2c1-t33 r1c3-t33" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-One Mapping|One-to-One Mapping]]<br>
+
| headers="r3c1-t33 r1c2-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r3c1-t33 r1c3-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#One-to-Many Mapping|One-to-Many Mapping]]<br>
+
| headers="r4c1-t33 r1c2-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t33 r1c3-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20Relational%20Mappings%20(ELUG)#Many-to-Many Mapping|Many-to-Many Mapping]]<br>
+
| headers="r5c1-t33 r1c2-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r5c1-t33 r1c3-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r6c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]]<br>
+
| headers="r6c1-t33 r1c2-t33" align="left" | <br>
+
| headers="r6c1-t33 r1c3-t33" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r7c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-One Mapping|EIS One-to-One Mapping]]<br>
+
| headers="r7c1-t33 r1c2-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t33 r1c3-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r8c1-t33" headers="r1c1-t33" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS One-to-Many Mapping|EIS One-to-Many Mapping]]<br>
+
| headers="r8c1-t33 r1c2-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r8c1-t33 r1c3-t33" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure Bidirectional Relationship Using Workbench===
+
 
+
To maintain a bidirectional relationship for a mapping, use this procedure:
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="'Figure 117-20"></span>''' General tab, Maintains Bidirectional Relationship option'''''<br>[[Image:oogenbid.gif|General tab, Maintains Bidirectional Relationship option]]<br><br>
+
# Complete the Bidirectional Relationship fields.
+
 
+
Use this table to enter data in the following fields on the tab:
+
 
+
{| class="HRuleInformal" dir="ltr" title="This table describes the Maintain Bidirectional Relationship fields." summary="This table describes the Maintain Bidirectional Relationship fields." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows"
+
|- align="left" valign="top"
+
! id="r1c1-t34" align="left" valign="bottom" | '''Field'''
+
! id="r1c2-t34" align="left" valign="bottom" | '''Description'''
+
|- align="left" valign="top"
+
| id="r2c1-t34" headers="r1c1-t34" align="left" | '''Maintains Bidirectional Relationship'''
+
| headers="r2c1-t34 r1c2-t34" align="left" | Specify if EclipseLink should maintain the bidirectional link for this relational mapping.
+
|- align="left" valign="top"
+
| id="r3c1-t34" headers="r1c1-t34" align="left" | '''Relationship Partner'''
+
| headers="r3c1-t34 r1c2-t34" align="left" | Select the relationship partner (from the list of mapped attributes of the '''Reference Descriptor''') for this bidirectional relationship.
+
|}
+
 
+
<br>
+
 
+
 
+
 
+
===How to Configure Bidirectional Relationship Using Java===
+
 
+
If a mapping has a bidirectional relationship in which the two classes in the relationship reference each other with one-to-one mappings, then set up the foreign key information as follows:
+
 
+
* One mapping must call the <tt>setForeignKeyFieldName</tt> method.
+
* The other must call the <tt>setTargetForeignKeyFieldName</tt> method.
+
 
+
You can also set up composite foreign key information by calling the <tt>addForeignKeyFieldName</tt> and <tt>addTargetForeignKeyFieldName</tt> methods. Because EclipseLink enables indirection (lazy loading) by default, the attribute must be a <tt>ValueHolderInterface</tt>.
+
 
+
<br>
+
 
+
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
+
| align="left" |
+
'''Note'''<nowiki>:</nowiki> When your application does not use a cache, enable indirection for at least one object in a bidirectional relationship. In rare cases, disabling indirection on both objects in the bidirectional relationship can lead to infinite loops. For more information, see the following:
+
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Directionality|Directionality]]
+
* [[Introduction%20to%20Mappings%20(ELUG)#Indirection (Lazy Loading)|Indirection (Lazy Loading)]]
+
|}
+
 
+
<br>
+
 
+
The following example demonstrates setting of bidirectional relationship between the <tt>Policy</tt> and <tt>Carrier</tt> classes. The foreign key is stored in the <tt>Policy</tt>’s table referencing the composite primary key of the <tt>Carrier</tt>.
+
 
+
<span id="Example 120–18"></span>
+
''''' Implementing a Bidirectional Mapping Between Two Classes that Reference Each Other'''''
+
 
+
public class Policy {
+
    ...
+
    '''// create the mapping that references the Carrier class'''
+
    OneToOneMapping carrierMapping = new OneToOneMapping();
+
    carrierMapping.setAttributeName("carrier");
+
    carrierMapping.setReferenceClass(Carrier.class);
+
    carrierMapping.addForeignKeyFieldName("INSURED_ID", "CARRIER_ID");
+
    carrierMapping.addForeignKeyFieldName("INSURED_TYPE", "TYPE");
+
    descriptor.addMapping(carrierMapping);
+
    ...
+
}
+
 
+
public class Carrier {
+
    ...
+
    '''// create the mapping that references the Policy class'''
+
    OneToOneMapping policyMapping = new OneToOneMapping();
+
    policyMapping.setAttributeName("masterPolicy");
+
    policyMapping.setReferenceClass(Policy.class);
+
    policyMapping.addTargetForeignKeyFieldName("INSURED_ID", "CARRIER_ID");
+
    policyMapping.addTargetForeignKeyFieldName("INSURED_TYPE", "TYPE");
+
    descriptor.addMapping(policyMapping);
+
    ...
+
}
+
 
+
==Configuring the Use of a Single Node==
+
 
+
For the XML-based mappings that the [[#Table 117-20|Mapping Support for Use Single Node]] table summarizes, when you map a list value, you can configure whether or not the mapping unmarshalls (writes) the list to a single node, like <tt><item>aaa bbb ccc</item></tt>, or to multiple nodes, like the following:
+
<item>aaa</item>
+
<item>bbb</item>
+
<item>ccc</item>
+
 
+
This table summarizes which mappings support this option.
+
 
+
 
+
<span id="Table 117-20"></span>
+
''''' Mapping Support for Use Single Node'''''
+
 
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Use Single Node" summary="This table summarizes which mappings support Use Single Node" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t35" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t35" align="left" valign="bottom" | '''[[#How to Configure the Use of a Single Node Using Workbench|Using Workbench]]<br>'''
+
! id="r1c3-t35" align="left" valign="bottom" | '''[[#How to Configure the Use of a Single Node Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#EIS Mappings|EIS Mappings]] <sup>Foot 1 </sup>
+
| headers="r2c1-t35 r1c2-t35" align="left" | <br>
+
| headers="r2c1-t35 r1c3-t35" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Direct Mapping|EIS Direct Mapping]]<br>
+
| headers="r3c1-t35 r1c2-t35" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t35 r1c3-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20EIS%20Mappings%20(ELUG)#EIS Composite Direct Collection Mapping|EIS Composite Direct Collection Mapping]]<br>
+
| headers="r4c1-t35 r1c2-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r4c1-t35 r1c3-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r5c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r5c1-t35 r1c2-t35" align="left" | <br>
+
| headers="r5c1-t35 r1c3-t35" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r6c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Direct Mapping|XML Direct Mapping]]<br>
+
| headers="r6c1-t35 r1c2-t35" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r6c1-t35 r1c3-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r7c1-t35" headers="r1c1-t35" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r7c1-t35 r1c2-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
| headers="r7c1-t35 r1c3-t35" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
<br><sup>Footnote 1 </sup>When used with XML records only (see [[Configuring%20an%20EIS%20Descriptor%20(ELUG)#Configuring Record Format|Configuring Record Format]]).<br>
+
 
+
 
+
 
+
===How to Configure the Use of a Single Node Using Workbench===
+
 
+
To configure a mapping to use a single node, use this procedure.
+
 
+
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor.
+
# Click the '''General''' tab. The General tab appears.<br><span id="Figure 117-21"></span>''''' General Tab, Use Single Node Option'''''<br>[[Image:usesingle.gif|General Tab, Use Single Node Option]]<br><br>
+
# Complete the '''Use single node''' field on the tab.
+
#:To configure the mapping to unmarshall (write) a list value to a single node (like <tt><item>aaa bbb ccc</item></tt>), click '''Use single node'''.
+
#:By default, the mapping unmarshalls a list value to separate nodes.
+
 
+
 
+
 
+
 
+
 
+
===How to Configure the Use of a Single Node Using Java===
+
 
+
Use <tt>AbstractCompositeDirectCollectionMapping</tt> method <tt>setUsesSingleNode</tt> to configure the mapping to write a list value to a single node by passing in a value of <tt>true</tt>. To configure the mapping to write a list value to multiple nodes, pass in a value of <tt>false</tt>.
+
 
+
For any mapping that takes an <tt>XMLField</tt>, use <tt>XMLField</tt> method <tt>setUsesSingleNode</tt> to configure the mapping to write a list value to a single node by passing in a value of <tt>true</tt>. To configure the mapping to write a list value to multiple nodes, pass in a value of <tt>false</tt>. This example shows how to use this method with an <tt>XMLDirectMapping</tt><nowiki>:</nowiki>
+
 
+
 
+
<span id="Example 117-17"></span>
+
''''' Using XMLField Method setUsesSingleNode'''''
+
 
+
XMLDirectMapping tasksMapping = new XMLDirectMapping();
+
tasksMapping.setAttributeName("tasks");
+
XMLField myField = new XMLField("tasks/text()"); '''// pass in the XPath'''
+
myField.setUsesSingleNode(true);
+
tasksMapping.setField(myField);
+
 
+
 
+
 
+
==Configuring the Use of CDATA==
+
For the XML-based mappings that the [[#Table 117-6| Mapping Support for Default Null Values]] table summarizes, when you create a mapping, you can configure whether or not the mapping's text is wrapped in a <tt><![CDATA[...]]></tt> statement.
+
 
+
This table summarizes which mappings support this option.
+
 
+
<span id="Table 117-21"></span>
+
{| class="RuleFormal" dir="ltr" title="Mapping Support for Use of CDATA" summary="This table summarizes which mappings support Use Single Node" width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
+
|- align="left" valign="top"
+
! id="r1c1-t36" align="left" valign="bottom" | '''Mapping'''
+
! id="r1c2-t36" align="left" valign="bottom" | '''[[#How to Configure the Use of a Single Node Using Workbench|Using the Workbench]]<br>'''
+
! id="r1c3-t36" align="left" valign="bottom" | '''[[#How to Configure the Use of a Single Node Using Java|Using Java]]<br>'''
+
|- align="left" valign="top"
+
| id="r2c1-t36" headers="r1c1-t36" align="left" |
+
[[Introduction%20to%20Mappings%20(ELUG)#XML Mappings|XML Mappings]]<br>
+
| headers="r2c1-t36 r1c2-t36" align="left" | <br>
+
| headers="r2c1-t36 r1c3-t36" align="left" | <br>
+
|- align="left" valign="top"
+
| id="r3c1-t36" headers="r1c1-t36" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)|XML Direct Mapping]]<br>
+
| headers="r3c1-t36 r1c2-t36" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r3c1-t36 r1c3-t36" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|- align="left" valign="top"
+
| id="r4c1-t36" headers="r1c1-t36" align="left" |
+
[[Introduction%20to%20XML%20Mappings%20(ELUG)#XML Composite Direct Collection Mapping|XML Composite Direct Collection Mapping]]<br>
+
| headers="r4c1-t36 r1c2-t36" align="left" |
+
[[Image:unsupport.gif|Unsupported]]<br>
+
| headers="r4c1-t36 r1c3-t36" align="left" |
+
[[Image:support.gif|Supported.]]<br>
+
|}
+
 
+
 
+
 
+
 
+
===How to Configure the Use of CDATA Using Java===
+
Use the <tt>isCDATA()</tt> method on an <tt>XMLDirectMapping</tt> or <tt>XMLCompositeDirectCollectionMapping</tt> to specify if the mapping's text is wrapped in a <tt><![CDATA[...]]></tt> statement. The following example shows the results of using this method:
+
 
+
<span id="Example 117-18"></span>
+
''''' Using CDATA'''''
+
 
+
When <tt>isCDATA = false</tt> on the name mapping, EclipseLink writes the text as a regular text node:
+
<employee>
+
  <name>Jane Doe</name>
+
</employee>
+
 
+
When <tt>isCDATA = true</tt> on the name mapping, EclipseLink wraps the text in a <tt><![CDATA[...]]></tt> statement:
+
<employee>
+
  <name>
+
    <![CDATA[Jane Doe]]>
+
  </name>
+
</employee>
+
 
+
  
  
Line 3,125: Line 122:
  
 
[[Category: EclipseLink User's Guide]]
 
[[Category: EclipseLink User's Guide]]
[[Category: Task]]
 
 
[[Category: Draft]]
 
[[Category: Draft]]
 +
[[Category: Task]]
 +
[[Category: ORM]]

Revision as of 14:54, 14 December 2007

This section describes the various components that you must configure in order to use a relational one-to-one 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 one-to-one mapping.


Option to Configure Workbench Java

Reference descriptor

Supported

Supported

Method or direct field access

Supported

Supported

Read-only mapping

Supported

Supported

Private or Independent relationships)

Supported

Supported

Batch reading

Supported

Supported

Joining

Supported

Supported

Indirection (lazy loading))

Supported

Supported

Bidirectional relationship

Supported

Supported

Mapping comments

Supported

Supported

Table and field references (see Configuring Joining at the Mapping Level)

Supported

Supported


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

One-to-One Mapping

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

    // configure mapping
    ... 

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

For more information, see the following:


For information on using JPA to configure one-to-one mappings, see @OneToOne.



Copyright Statement

Back to the top