30 Configuring a Relational Direct-to-XMLType Mapping

This chapter describes the various components that you must configure in order to use a relational direct-to-XMLType mapping.

This chapter includes the following sections:

For information on how to configure TopLink mappings options common to two or more mapping types, see Chapter 121, "Configuring a Mapping".

For information on how to create TopLink mappings, see Chapter 120, "Creating a Mapping".

Table 30-1 lists the configurable options for a relational direct-to-XMLType mapping.

30.1 Introduction to Relational Direct-to-XMLType Mapping

Table 30-1 lists the configurable options for a relational direct-to-XMLType mapping.

Table 30-1 Configurable Options for Relational Direct-To-XMLType Mapping

Option to Configure Oracle JDeveloper
TopLink Workbench

Database field (see Section 28.3, "Configuring a Database Field")

Supported Supported Supported

Method or direct field access (see Section 121.6, "Configuring Method or Direct Field Accessing at the Mapping Level")

Supported Supported Supported

Read-only (see Section 121.2, "Configuring Read-Only Mappings")

Supported Supported Supported

Read whole document (see Section 30.2, "Configuring Read Whole Document")

Supported Supported Supported

Mapping comments (see Section 121.8, "Configuring Mapping Comments")

Supported Supported Supported

Example 30-1 shows how to create a direct-to-XMLType mapping and add it to a descriptor using Java code.

Example 30-1 Direct-to-XMLType Mapping

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

    // configure mapping

    // add mapping to descriptor

For more information, see the following:

30.2 Configuring Read Whole Document

When mapping an XML Type to a Document Object Model (DOM), by default TopLink 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.

30.2.1 How to Configure Read Whole Document Using TopLink 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.

    Figure 30-1 DIrect to XML Mapping Property Sheet, Read Whole Document Option

    Description of Figure 30-1 follows
    Description of "Figure 30-1 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 TopLink to read the database values.

30.2.2 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 Oracle Fusion Middleware Java API Reference for Oracle TopLink.