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 Direct-to-XMLType Mapping (ELUG)"
m |
m (→How to Configure Read Whole Document Using Java) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<div style="float:right;border:1px solid #000000;padding:5px">__TOC__ | <div style="float:right;border:1px solid #000000;padding:5px">__TOC__ | ||
− | [[Special:Whatlinkshere/Introduction to Relational Mappings (ELUG)|Related Topics]]</div> | + | [[Special:Whatlinkshere/Introduction to Relational Mappings (ELUG)|Related Topics]]</div> |
− | + | ||
− | + | ||
For information on how to create EclipseLink mappings, see [[Creating%20a%20Mapping%20(ELUG)|Creating a Mapping]]. | For information on how to create EclipseLink mappings, see [[Creating%20a%20Mapping%20(ELUG)|Creating a Mapping]]. | ||
Line 58: | Line 56: | ||
''''' Direct-to-XMLType Mapping''''' | ''''' Direct-to-XMLType Mapping''''' | ||
public void customize(ClassDescriptor descriptor) { | public void customize(ClassDescriptor descriptor) { | ||
− | + | DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping(); | |
// configure mapping | // configure mapping | ||
− | . | + | mapping.setAttributeName("document"); |
// add mapping to descriptor | // add mapping to descriptor | ||
descriptor.addMapping(mapping); | descriptor.addMapping(mapping); | ||
} | } | ||
− | |||
Line 72: | Line 69: | ||
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-XMLType Mapping|Direct-to-XMLType Mapping]] | * [[Introduction%20to%20Relational%20Mappings%20(ELUG)#Direct-to-XMLType Mapping|Direct-to-XMLType Mapping]] | ||
* [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | * [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Relational Mapping]] | ||
− | * [[ | + | * [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Mapping]]. |
==Configuring Read Whole Document== | ==Configuring Read Whole Document== | ||
+ | |||
When mapping an XML Type to a Document Object Model (DOM), by default EclipseLink uses the database representation of the DOM. This allows for lazy loading of the XML data from the database. | When mapping an XML Type to a Document Object Model (DOM), by default EclipseLink uses the database representation of the DOM. This allows for lazy loading of the XML data from the database. | ||
Line 84: | Line 82: | ||
===How to Configure Read Whole Document Using Workbench=== | ===How to Configure Read Whole Document Using Workbench=== | ||
+ | |||
To specify that this mapping reads the whole XML document, use this procedure: | To specify that this mapping reads the whole XML document, use this procedure: | ||
# Select the mapping in the '''Navigator'''. Its properties appear in the Editor. | # Select the mapping in the '''Navigator'''. Its properties appear in the Editor. | ||
# Click '''General'''. The General tab appears.<br><span id="Figure 35-1"></span>''''' Direct to XML Mapping Property Sheet, Read Whole Document Option'''''<br>[[Image:readwhl.gif|Direct to XML Mapping Property Sheet, Read Whole Document Option]] | # Click '''General'''. The General tab appears.<br><span id="Figure 35-1"></span>''''' Direct to XML Mapping Property Sheet, Read Whole Document Option'''''<br>[[Image:readwhl.gif|Direct to XML Mapping Property Sheet, Read Whole Document Option]] | ||
# Choose the '''Read Whole Document''' option to read the whole XML document. If you do not select this option, the connection must remain open for EclipseLink to read the database values. | # Choose the '''Read Whole Document''' option to read the whole XML document. If you do not select this option, the connection must remain open for EclipseLink to read the database values. | ||
− | |||
===How to Configure Read Whole Document Using Java=== | ===How to Configure Read Whole Document Using Java=== | ||
+ | |||
Use the following <tt>DirectToXMLTypeMapping</tt> methods: | Use the following <tt>DirectToXMLTypeMapping</tt> methods: | ||
* <tt>setShouldReadWholeDocument</tt> | * <tt>setShouldReadWholeDocument</tt> | ||
Line 106: | Line 105: | ||
[[Category: EclipseLink User's Guide]] | [[Category: EclipseLink User's Guide]] | ||
− | [[Category: | + | [[Category: Release 1]] |
[[Category: Task]] | [[Category: Task]] | ||
[[Category: ORM]] | [[Category: ORM]] |
Latest revision as of 07:37, 20 August 2008
Contents
For information on how to create EclipseLink mappings, see Creating a Mapping.
This table lists the configurable options for a relational direct-to-XMLType mapping.
Option to Configure | Workbench | Java |
---|---|---|
This example shows how to create a direct-to-XMLType mapping and add it to a descriptor using Java code.
Direct-to-XMLType Mapping
public void customize(ClassDescriptor descriptor) { DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping(); // configure mapping mapping.setAttributeName("document"); // add mapping to descriptor descriptor.addMapping(mapping); }
For more information, see the following:
Configuring Read Whole Document
When mapping an XML Type to a Document Object Model (DOM), by default EclipseLink uses the database representation of the DOM. This allows for lazy loading of the XML data from the database.
However, if you require the entire DOM, (or if you require the DOM to be available in a disconnected fashion from the database connection) use the Read Whole option to retrieve the entire DOM from the database.
How to Configure Read Whole Document Using Workbench
To specify that this mapping reads the whole XML document, use this procedure:
- Select the mapping in the Navigator. Its properties appear in the Editor.
- Click General. The General tab appears.
Direct to XML Mapping Property Sheet, Read Whole Document Option - Choose the Read Whole Document option to read the whole XML document. If you do not select this option, the connection must remain open for EclipseLink to read the database values.
How to Configure Read Whole Document Using Java
Use the following DirectToXMLTypeMapping methods:
- setShouldReadWholeDocument
- shouldReadWholeDocument
For more information about the available methods for DirectToXMLTypeMapping, see the EclipseLink API Reference.