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 One-to-One Mapping (ELUG)"
m |
m (→Introduction to Relational One-to-One Mapping Configuration) |
||
Line 96: | Line 96: | ||
|} | |} | ||
+ | This example shows how to create a one-to-one mapping and add it to a descriptor using Java code. | ||
+ | |||
+ | <span id="Example 38-1"></span> | ||
+ | ''''' One-to-One Mapping''''' | ||
+ | |||
+ | <pre> | ||
+ | public void customize(ClassDescriptor descriptor) { | ||
+ | OneToOneMapping mapping = new OneToOneMapping(); | ||
+ | |||
+ | // configure mapping | ||
+ | ... | ||
+ | |||
+ | // add mapping to descriptor | ||
+ | descriptor.addMapping(mapping); | ||
+ | } | ||
+ | </pre> | ||
Line 102: | Line 118: | ||
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)|One-to-One Mapping]] | * [[Introduction%20to%20Relational%20Mappings%20(ELUG)|One-to-One Mapping]] | ||
* [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | * [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | ||
+ | * [[Creating%20and%20Configuring%20Mappings%20(ELUG)|Creating and Configuring Mappings]] | ||
For information on using JPA to configure one-to-one mappings, see [[Introduction%20to%20EclipseLink%20JPA%20(ELUG)|@OneToOne]]. | For information on using JPA to configure one-to-one mappings, see [[Introduction%20to%20EclipseLink%20JPA%20(ELUG)|@OneToOne]]. |
Revision as of 14:57, 29 November 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.
Configurable Options for Relational One-to-One Mapping lists the configurable options for a relational one-to-one mapping.
Introduction to Relational One-to-One Mapping Configuration
This table lists the configurable options for a relational one-to-one mapping.
Configurable Options for Relational One-to-One Mapping
Option to Configure | 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) |
||
Private or Independent relationships (see Configuring Mapping Comments) |
||
Batch reading (see Configuring Batch Reading) |
||
Joining (see Configuring Joining at the Mapping Level) |
||
Indirection (lazy loading) (see Configuring Mapping Comments) |
||
Bidirectional relationship (see Configuring Bidirectional Relationship) |
||
Mapping comments (see Configuring Mapping Comments) |
||
Table and field references (see Configuring Joining at the Mapping Level) |
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.