Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Configuring a Relational Aggregate Object Mapping (ELUG)"
m (New page: <div style="float:right;border:1px solid #000000;padding:5px">__TOC__ Related Topics</div> This section d...) |
m |
||
Line 7: | Line 7: | ||
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups" | {| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups" | ||
| align="left" | | | align="left" | | ||
− | '''Note:''' You configure the relational aggregate object mapping in the source object's descriptor. However, before doing so, you must designate the target object's descriptor as an aggregate (see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)|Configuring a Relational Descriptor as a Class or Aggregate Type]]). | + | '''Note:''' You configure the relational aggregate object mapping in the source object's descriptor. However, before doing so, you must designate the target object's descriptor as an aggregate (see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)#Configuring a Relational Descriptor as a Class or Aggregate Type|Configuring a Relational Descriptor as a Class or Aggregate Type]]). |
|} | |} | ||
− | |||
− | |||
For information on how to configure EclipseLink mappings options common to two or more mapping types, see [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Mapping]]. | For information on how to configure EclipseLink mappings options common to two or more mapping types, see [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Mapping]]. | ||
Line 80: | Line 78: | ||
For more information, see the following: | For more information, see the following: | ||
− | |||
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Object Mapping|Aggregate Object Mapping]] | * [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Aggregate Object Mapping|Aggregate Object Mapping]] | ||
* [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | * [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | ||
+ | |||
+ | |||
==Configuring Aggregate Fields== | ==Configuring Aggregate Fields== | ||
Line 90: | Line 89: | ||
This section explains how to configure the source class descriptor to define where each target class field is mapped. | This section explains how to configure the source class descriptor to define where each target class field is mapped. | ||
− | For more information on how to configure the target class descriptor to define how each target class field is mapped, see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)|Configuring a Relational Descriptor as a Class or Aggregate Type]]. | + | For more information on how to configure the target class descriptor to define how each target class field is mapped, see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)#Configuring a Relational Descriptor as a Class or Aggregate Type|Configuring a Relational Descriptor as a Class or Aggregate Type]]. |
Line 99: | Line 98: | ||
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor. | # Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor. | ||
− | # Click the '''Fields''' tab. The Fields tab appears.<br>''''' | + | # Click the '''Fields''' tab. The Fields tab appears.<br><span id="Figure 42-1"></span>''''' Fields Tab'''''<br>[[Image:agmapfie.gif|Fields Tab]] |
# Complete the fields on the '''Fields''' tab. | # Complete the fields on the '''Fields''' tab. | ||
Use the following information to complete each field on the tab: | Use the following information to complete each field on the tab: | ||
− | |||
− | |||
{| class="HRuleInformal" dir="ltr" title="the Fields tab." summary="This table identifies each field on the Fields tab." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows" | {| class="HRuleInformal" dir="ltr" title="the Fields tab." summary="This table identifies each field on the Fields tab." width="100%" border="1" frame="hsides" rules="rows" cellpadding="3" frame="hsides" rules="rows" | ||
Line 113: | Line 110: | ||
| id="r2c1-t4" headers="r1c1-t4" align="left" | '''Field Description''' | | id="r2c1-t4" headers="r1c1-t4" align="left" | '''Field Description''' | ||
| headers="r2c1-t4 r1c2-t4" align="left" | | | headers="r2c1-t4 r1c2-t4" align="left" | | ||
− | This column shows the name of the fields from the target object, whose descriptor is designated as an aggregate (see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)|Configuring a Relational Descriptor as a Class or Aggregate Type]]). These are for display only and cannot be changed. | + | This column shows the name of the fields from the target object, whose descriptor is designated as an aggregate (see [[Configuring%20a%20Relational%20Descriptor%20(ELUG)#onfiguring a Relational Descriptor as a Class or Aggregate Type|Configuring a Relational Descriptor as a Class or Aggregate Type]]). These are for display only and cannot be changed. |
|- align="left" valign="top" | |- align="left" valign="top" | ||
| id="r3c1-t4" headers="r1c1-t4" align="left" | '''Fields''' | | id="r3c1-t4" headers="r1c1-t4" align="left" | '''Fields''' | ||
| headers="r3c1-t4 r1c2-t4" align="left" | Use this column to select the source object database table field that EclipseLink will map to the corresponding target object field. | | headers="r3c1-t4 r1c2-t4" align="left" | Use this column to select the source object database table field that EclipseLink will map to the corresponding target object field. | ||
|} | |} | ||
+ | |||
+ | |||
===How to Configure Aggregate Fields Using Java=== | ===How to Configure Aggregate Fields Using Java=== | ||
Line 124: | Line 123: | ||
For more information about the available methods for <tt>AggregateObjectMapping</tt>, see the ''EclipseLink API Reference''. | For more information about the available methods for <tt>AggregateObjectMapping</tt>, see the ''EclipseLink API Reference''. | ||
+ | |||
+ | |||
==Configuring Allowing Null Values== | ==Configuring Allowing Null Values== | ||
Line 136: | Line 137: | ||
# Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor. | # Select the mapped attribute in the '''Navigator'''. Its properties appear in the Editor. | ||
− | # Click the '''General''' tab. The General tab appears.<br>''''' | + | # Click the '''General''' tab. The General tab appears.<br><span id="Figure 42-2"></span>''''' General Tab, Allow Null Option'''''<br>[[Image:agmapnul.gif|General Tab, Allow Null Option]] |
− | + | #Select the '''Allows Null''' option to allow this mapping to contain a null value. | |
− | Select the '''Allows Null''' option to allow this mapping to contain a null value. | + | |
Line 147: | Line 147: | ||
For more information about the available methods for <tt>AggregateObjectMapping</tt>, see the ''EclipseLink API Reference''. | For more information about the available methods for <tt>AggregateObjectMapping</tt>, see the ''EclipseLink API Reference''. | ||
+ | |||
Revision as of 20:13, 29 November 2007
Contents
This section describes the various components that you must configure in order to use a relational aggregate object mapping.
Note: You configure the relational aggregate object mapping in the source object's descriptor. However, before doing so, you must designate the target object's descriptor as an aggregate (see Configuring a Relational Descriptor as a Class or Aggregate Type). |
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.
Configurable Options for Relational Aggregate Object Mapping lists the configurable options for a relational aggregate object mapping.
Introduction to Relational Aggregate Object Mapping Configuration
This table lists the configurable options for a relational aggregate object mapping.
Configurable Options for Relational Aggregate Object Mapping
Option | Workbench | Java |
---|---|---|
Reference descriptor (see Configuring Reference Descriptor) |
||
Method or direct field access (see Configuring a Type Conversion Converter) |
||
Read-only mapping (see Configuring Read-Only Mappings) |
||
Allowing null values (see #Configuring Allowing Null Values) |
||
Mapping comments (see Configuring Mapping Comments) |
||
Aggregate fields (see #Configuring Aggregate Fields) |
For more information, see the following:
Configuring Aggregate Fields
When you designate a descriptor as an aggregate, EclipseLink allows you to specify a mapping type for each field in the target class, but defers associating the field with a database table until you configure the aggregate object mapping in the source class descriptor. In other words, the target class descriptor defines how each target class field is mapped but the source class descriptor defines where each target class field is mapped.
This section explains how to configure the source class descriptor to define where each target class field is mapped.
For more information on how to configure the target class descriptor to define how each target class field is mapped, see Configuring a Relational Descriptor as a Class or Aggregate Type.
How to Configure Aggregate Fields Using Workbench
To specify the mapped fields of an aggregate mapping, use this procedure.
- Select the mapped attribute in the Navigator. Its properties appear in the Editor.
- Click the Fields tab. The Fields tab appears.
Fields Tab - Complete the fields on the Fields tab.
Use the following information to complete each field on the tab:
Field | Description |
---|---|
Field Description |
This column shows the name of the fields from the target object, whose descriptor is designated as an aggregate (see Configuring a Relational Descriptor as a Class or Aggregate Type). These are for display only and cannot be changed. |
Fields | Use this column to select the source object database table field that EclipseLink will map to the corresponding target object field. |
How to Configure Aggregate Fields Using Java
Using the AggregateObjectMapping method addFieldNameTranslation you can set a field name translation that maps from a field name in the source table to a field name in the aggregate descriptor
For more information about the available methods for AggregateObjectMapping, see the EclipseLink API Reference.
Configuring Allowing Null Values
If all the fields in the database row for the aggregate object are null, then, by default, EclipseLink places null in the appropriate source object, as opposed to filling an aggregate object with null values.
How to Configure Allowing Null Values Using Workbench
To allow a mapping to contain a null value, use this procedure.
- Select the mapped attribute in the Navigator. Its properties appear in the Editor.
- Click the General tab. The General tab appears.
General Tab, Allow Null Option - Select the Allows Null option to allow this mapping to contain a null value.
How to Configure Allowing Null Values Using Java
You can configure whether or not to allow null values using the AggregateObjectMapping methods allowNull and dontAllowNull.
For more information about the available methods for AggregateObjectMapping, see the EclipseLink API Reference.