Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Introduction to Object-Relational Data Type Mappings (ELUG)

Revision as of 13:51, 26 November 2007 by Rick.sapir.oracle.com (Talk | contribs) (New page: <div style="float:right;border:1px solid #000000;padding:5px">__TOC__ Related Topics</div> An object-r...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

An object-relational data type mapping transforms certain object data member types to structured data source representations optimized for storage in specialized object-relational data type databases (such as Oracle Database). Object-relational data type mappings let you map an object model into an object-relational data type data model.

Do not confuse object-relational data type mappings with relational mappings (see Transformation Mapping). A relational mapping transforms any object data member type to a corresponding relational database (SQL) data source representation in any supported relational database. Relational mappings let you map an object model into a relational data model. In general, you can use relational mappings with any supported relational database. You can only use object-relational data type mappings with specialized object-relational data type databases optimized to support object-relational data type data source representations.

For information on mapping concepts and features common to more than one type of EclipseLink mappings, see Introduction to Mappings.


Object-Relational Data Type Mapping Types

EclipseLink supports the object-relational data type mappings listed in EclipseLink Object-Relationship Mapping Types.

These mappings allow for an object model to persist in an object-relational data type data model. The Workbench does not support object-relational data type mappings–they must be defined in code or through amendment methods.


EclipseLink Object-Relationship Mapping Types

Type of Mapping Description EclipseLink Workbench Java

Object-relational data type structure mapping (see #Object-Relational Data Type Structure Mapping)

Map to object-relational data type aggregate structures (the Struct type in JDBC and the OBJECT type in Oracle Databasei)

Unsupported

Supported

Object-relational data type reference mapping (see #Object-Relational Data Type Reference Mapping)

Map to object-relational data type references (the Ref type in JDBC and the REF type in Oracle Database)

Unsupported

Supported

Object-relational data type array mapping (see #Object-Relational Data Type Array Mapping)

Map a collection of primitive data to object-relational data type array data types (the Array type in JDBC and the VARRAY type in Oracle Database).

Unsupported

Supported

Object-relational data type object array mapping (see #Object-Relational Data Type Object Array Mapping)

Map to object-relational data type array data types (the Array type in JDBC and the VARRAY type in Oracle Database).

Unsupported

Supported

Object-relational data type nested table mapping (see #Object-Relational Data Type Nested Table Mapping

Map to object-relational data type nested tables (the Array type in JDBC and the NESTED TABLE type in Oracle Database)

Unsupported

Supported


Object-Relational Data Type Structure Mapping

In an object-relational data type data model, structures are user-defined data types or object types. This is similar to a Java class–it defines attributes or fields in which each attribute is one of the following:

  • A primitive data type.
  • Another structure.
  • Reference to another structure.

EclipseLink maps nested structures with the StructureMapping class. The structure mapping supports null values and shared aggregates without requiring additional settings (because of the object-relational data type support of the database).

See Chapter 46, "Configuring an Object-Relational Data Type Structure Mapping" for more information.


Object-Relational Data Type Reference Mapping

In an object-relational data type data model, structures reference each other through refs–not through foreign keys (as in a traditional data model). Refs are based on the target structure's ObjectID. They represent an object reference in Java.

EclipseLink maps refs with the ReferenceMapping class. The reference mapping does not require foreign key information (because of the object-relational data type support of the database).

See Chapter 47, "Configuring an Object-Relational Data Type Reference Mapping" for more information.

Object-Relational Data Type Array Mapping

In an object-relational data type data model, structures can contain arrays (collections of other data types). These arrays can contain primitive data types or collections of other structures.

EclipseLink maps arrays of primitive data types with the ArrayMapping class. An array mapping maps to object-relational data type array data types (the Array type in JDBC and the VARRAY type in Oracle Database). To map a collection of aggregate structures, use an object array mapping (see #Object-Relational Data Type Object Array Mapping).

The object-relational data type database stores the arrays with their parent structure in the same table. To store information in a separate table from the parent structure's table, use a nested table mapping (see #Object-Relational Data Type Nested Table Mapping).

All elements in the array must be the same data type. The number of elements in an array controls the size of the array. An Oracle Database allows arrays of variable sizes (the VARRAY type).

See Chapter 48, "Configuring an Object-Relational Data Type Array Mapping" for more information.


Object-Relational Data Type Object Array Mapping

In an object-relational data type data model, structures can contain arrays (collections of other data types). These arrays can contain primitive data types or collections of other structures.

EclipseLink maps arrays of structures with the ObjectArrayMapping class. An object array mapping defines a collection-aggregated relationship, in which the target objects share the same row as the source object.

You must associate this mapping to an attribute in the parent class.

See Chapter 49, "Configuring an Object-Relational Data Type Object Array Mapping" for more information.


Object-Relational Data Type Nested Table Mapping

Nested table types model an unordered set of elements. These elements may be built-in or user-defined types. You can view a nested table as a single-column table or, if the nested table is an object type, as a multicolumn table (with a column for each attribute of the object type).

EclipseLink maps nested tables with the NestedTableMapping class. It represents a collection of object references in Java. Because of the object-relational data type support of the database, nested table mapping does not require foreign key information (as with a one-to-many mapping) or a relational table (as with a many-to-many mapping).

Typically, nested tables represent a one-to-many or many-to-many relationship of references to another independent structure. They support querying and joining better than the VARRAY types that are in-lined to the parent table. EclipseLink supports mapping a nested table of REF types only. EclipseLink does not support nested tables of basic or other structured data types–use array (see [[#Object-Relational Data Type Array Mapping]) or object array (see [[#Object-Relational Data Type Object Array Mapping]) mappings instead.

See [[Configuring an Object-Relational Data Type Nested Table Mapping (ELUG)|Chapter 51, "Configuring an Object-Relational Data Type Nested Table Mappin] for more information.



Copyright Statement

Copyright © Eclipse Foundation, Inc. All Rights Reserved.