Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "Configuring a Relational Direct-to-XMLType Mapping (ELUG)"

m (Introduction to Relational Direct-to-XMLType Mapping)
m
Line 19: Line 19:
 
<span id="Table 35-1"></span>
 
<span id="Table 35-1"></span>
 
''''' Configurable Options for Relational Direct-To-XMLType Mapping'''''
 
''''' Configurable Options for Relational Direct-To-XMLType Mapping'''''
 
 
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Relational Direct-To-XMLType Mapping" summary="This table lists the configurable options common to Relational Direct-To-XMLType Mapping and categorizes them as Basic and Advanced and indicates if the option can be configured with the TopLink Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
 
{| class="RuleFormalMax" dir="ltr" title="Configurable Options for Relational Direct-To-XMLType Mapping" summary="This table lists the configurable options common to Relational Direct-To-XMLType Mapping and categorizes them as Basic and Advanced and indicates if the option can be configured with the TopLink Workbench, Java, or both." width="100%" border="1" frame="border" rules="all" cellpadding="3" frame="border" rules="all"
 
|- align="left" valign="top"
 
|- align="left" valign="top"
Line 27: Line 26:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
 
| id="r2c1-t2" headers="r1c1-t2" align="left" |
Database field (see [[Configuring%20a%20Relational%20Mapping%20(ELUG)|Configuring a Database Field]])
+
[[Configuring%20a%20Relational%20Mapping%20(ELUG)#Configuring a Database Field|Database field]]
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
| headers="r2c1-t2 r1c2-t2" align="left" |
 
[[Image:support.gif|Supported]]
 
[[Image:support.gif|Supported]]
Line 34: Line 33:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
 
| id="r3c1-t2" headers="r1c1-t2" align="left" |
Method or direct field access (see [[Configuring%20a%20Mapping%20(ELUG)|Configuring a Type Conversion Converter]])
+
[[Configuring%20a%20Mapping%20(ELUG)|Method or direct field access]]
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
| headers="r3c1-t2 r1c2-t2" align="left" |
 
[[Image:support.gif|Supported]]
 
[[Image:support.gif|Supported]]
Line 41: Line 40:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
 
| id="r4c1-t2" headers="r1c1-t2" align="left" |
Read-only (see [[Configuring%20a%20Mapping%20(ELUG)|Configuring Read-Only Mappings]])
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Read-Only Mappings|Read-only]]
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
| headers="r4c1-t2 r1c2-t2" align="left" |
 
[[Image:support.gif|Supported]]
 
[[Image:support.gif|Supported]]
Line 48: Line 47:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
 
| id="r5c1-t2" headers="r1c1-t2" align="left" |
Read whole document (see [[#Configuring Read Whole Document|Configuring Read Whole Document]])
+
[[#Configuring Read Whole Document|Configuring Read Whole Document]]
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
| headers="r5c1-t2 r1c2-t2" align="left" |
 
[[Image:support.gif|Supported]]
 
[[Image:support.gif|Supported]]
Line 55: Line 54:
 
|- align="left" valign="top"
 
|- align="left" valign="top"
 
| id="r6c1-t2" headers="r1c1-t2" align="left" |
 
| id="r6c1-t2" headers="r1c1-t2" align="left" |
Mapping comments (see [[Configuring%20a%20Mapping%20(ELUG)|Configuring Mapping Comments]])
+
[[Configuring%20a%20Mapping%20(ELUG)#Configuring Mapping Comments|Mapping comments]]
 
| headers="r6c1-t2 r1c2-t2" align="left" |
 
| headers="r6c1-t2 r1c2-t2" align="left" |
 
[[Image:support.gif|Supported]]
 
[[Image:support.gif|Supported]]
Line 67: Line 66:
 
<span id="Example 37-1"></span>
 
<span id="Example 37-1"></span>
 
''''' Direct-to-XMLType Mapping'''''
 
''''' Direct-to-XMLType Mapping'''''
 
+
public void customize(ClassDescriptor descriptor) {  
<pre>
+
public void customize(ClassDescriptor descriptor) {  
+
 
     DirectXMLTypeMapping mapping = new DirectXMLTypeMapping();   
 
     DirectXMLTypeMapping mapping = new DirectXMLTypeMapping();   
 
+
 
     // configure mapping
 
     // configure mapping
 
     ...  
 
     ...  
 
+
 
     // add mapping to descriptor
 
     // add mapping to descriptor
 
     descriptor.addMapping(mapping);
 
     descriptor.addMapping(mapping);
}
+
}
</pre>
+
 
 +
 
  
 
For more information, see the following:
 
For more information, see the following:
* [[Introduction%20to%20Relational%20Mappings%20(ELUG)|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]]
 
* [[Creating%20and%20Configuring%20Mappings%20(ELUG)|Creating and Configuring Mappings]]
 
* [[Creating%20and%20Configuring%20Mappings%20(ELUG)|Creating and Configuring Mappings]]
 +
 +
  
 
==Configuring Read Whole Document==
 
==Configuring Read Whole Document==
Line 94: Line 94:
  
 
===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.
 
  
'''See Also'''
 
: [[#Configuring Read Whole Document]]
 
  
===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>
 
* <tt>shouldReadWholeDocument</tt>
 
* <tt>shouldReadWholeDocument</tt>
  
 
For more information about the available methods for <tt>DirectToXMLTypeMapping</tt>, see the ''EclipseLink API Reference''.
 
For more information about the available methods for <tt>DirectToXMLTypeMapping</tt>, see the ''EclipseLink API Reference''.
 +
  
  

Revision as of 11:48, 4 December 2007


This section describes the various components that you must configure in order to use a relational direct-to-XMLType 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 Direct-To-XMLType Mapping lists the configurable options for a relational direct-to-XMLType mapping.


Introduction to Relational Direct-to-XMLType Mapping

This table lists the configurable options for a relational direct-to-XMLType mapping.


Configurable Options for Relational Direct-To-XMLType Mapping

Option to Configure Workbench Java

Database field

Supported

Supported

Method or direct field access

Supported

Supported

Read-only

Supported

Supported

Configuring Read Whole Document

Supported

Supported

Mapping comments

Supported

Supported


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) { 
   DirectXMLTypeMapping mapping = new DirectXMLTypeMapping();  

   // configure mapping
   ... 

   // 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:

  1. Select the mapping in the Navigator. Its properties appear in the Editor.
  2. Click General. The General tab appears.
    Direct to XML Mapping Property Sheet, Read Whole Document Option
    Direct to XML Mapping Property Sheet, Read Whole Document Option
  3. 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.



Copyright Statement

Back to the top