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

Difference between revisions of "EclipseLink/UserGuide/SDO/Introduction to EclipseLink SDO (ELUG)"

m (Defining Metadata)
m (Using Data)
Line 78: Line 78:
  
 
==Using Data==
 
==Using Data==
Information pending
+
You can use the following EclipseLink SDO classes to work with data:
 +
* [[#Using SDODataObject | SDOXSDHelper]]
 +
* [[#Using SDOXMLDocument | SDOXMLDocument]]
 +
* [[#Using SDOXMLDocument | SDOXMLDocument]]
 +
* [[#Using SDOXMLDocument | SDOXMLDocument]]
 +
* [[#Using SDOXMLDocument | SDOXMLDocument]]
  
===Using DataObject===
+
 
<!-- (see 17.2.6 “Mapping converters and transformers” in JITDG/ELUG) -->
+
 
<tt>DataObject</tt> in SDO corresponds to a Java <tt>Object</tt> (POJO).  
+
===Using SDODataObject===
 +
A <tt>DataObject</tt> in SDO corresponds to a Java <tt>Object</tt> (POJO).  
 
To define object-XML mappings, you map the <tt>DataObject</tt> to XML.
 
To define object-XML mappings, you map the <tt>DataObject</tt> to XML.
You can create your <tt>DataObject</tt> as either dynamic (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/DynamicAPI Dynamic DataObject Examples]), or static by applying a type-safe interface to it (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/StaticAPI Static DataObject Examples]).  
+
You can create your data object as either dynamic (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/DynamicAPI Dynamic DataObject Examples]), or static by applying a type-safe interface to it (see [http://wiki.eclipse.org/EclipseLink/Examples/SDO/StaticAPI Static DataObject Examples]).  
The <tt>DataObject</tt> provides an XPath-like (see [[Introduction_to_Mappings_%28ELUG%29#Mappings_and_XPath | Mappings and XPath]]) means of data access. For example, the following code is valid in SDO:  
+
The <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/SDODataObject.html SDODataObject]</tt> provides an XPath-like (see [[Introduction_to_Mappings_%28ELUG%29#Mappings_and_XPath | Mappings and XPath]]) means of data access. For example, the following code is valid in SDO:  
 
  customerDO.getDataObject("contact-info/phone-number[2]");  
 
  customerDO.getDataObject("contact-info/phone-number[2]");  
  
 
The standard JAXB, however, would require the following:
 
The standard JAXB, however, would require the following:
 
  customer.getContactInfo().getPhoneNumbers().get(1);  
 
  customer.getContactInfo().getPhoneNumbers().get(1);  
 +
 +
Note that you can use the EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/extension/XPathHelper.html XPathHelper]</tt> to query data objects using an XPath expression.
  
 
For more information, see [http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/DataObject.html DataObject API]
 
For more information, see [http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.ecore.sdo.doc/references/javadoc/commonj/sdo/DataObject.html DataObject API]
Line 95: Line 103:
  
 
====What You May Need to Know About Serialization in SDO====
 
====What You May Need to Know About Serialization in SDO====
<!-- (see 17.2.6.1 in JITDG/ELUG) -->
 
 
SDO has its own Java serialization format.
 
SDO has its own Java serialization format.
 +
The <tt>DataObject</tt> implements the <tt>Serializable</tt> interface.
 +
 +
Information pending.
  
  
===Using XMLDocument===
+
===Using SDOXMLDocument===
 
When you marshall (save) a <tt>DataObject</tt> to XML, or unmarshall an XML document into objects, the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLDocument.html XMLDocument]</tt> class contains information about the root of the XML document.
 
When you marshall (save) a <tt>DataObject</tt> to XML, or unmarshall an XML document into objects, the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLDocument.html XMLDocument]</tt> class contains information about the root of the XML document.
  
 +
For more information, see[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/SDOXMLDocument.html SDOXMLDocument API].
  
 
===What You May Need to Know About Sequence, ChangeSummary, and DataGraph===
 
===What You May Need to Know About Sequence, ChangeSummary, and DataGraph===

Revision as of 13:58, 28 April 2009

This section introduces EclipseLink implementation of Service Data Objects (SDO) specification, as well as provides information on how you can use it in your application development.


Using SDO Metadata

SDO metadata is represented as Type and Property objects. You define the metadata at run time either programmatically, or from an XML schema.


Using Type

SDO Type acts similarly to a Class in Java, and provides much of the same metadata as the Java Reflection API provides for Java classes.

In EclipseLink, a SDOType wraps an object-XML mapping (OXM) descriptor.

A Type can have supertypes, which corresponds to the EclipseLink concept of inheritance policy (see Inheritance Policy in Descriptor API).

For more information, see Type API.


What You May Need to Know About Open Sequenced Type

For information, see OpenSequencedType.


What You May Need to Know About DataObjectType for Data Types

For information, see SDODataObjectType.

Using Property

SDO Property acts similarly to a property in Java and provides much of the same metadata as the Java Reflection API provides for Java fields or methods.

In EclipseLink, a SDOProperty wraps an object-XML mapping in the following way:

  • DataType=true + isMany=false

Corresponds to EclipseLink OXM direct mappings and OXM binary mappings.

  • DataType=true + isMany=true

Corresponds to EclipseLink OXM direct collection mappings and OXM binary collection mappings.

  • DataType=false + isMany=false + containment=true

Corresponds to EclipseLink OXM composite object mappings.

  • DataType=false + isMany=true + containment=true

Corresponds to EclipseLink OXM composite collection mappings.

  • DataType=false + isMany=false + containment=false

Corresponds to EclipseLink OXM reference mappings.

  • DataType=false + isMany=true + containment=false

Corresponds to EclipseLink OXM collection reference mappings.


For more information, see Property API.

Defining Metadata

You can use the following EclipseLink helper classes to define SDO metadata:

Information pending: modifying and accessing the underlying EclipseLink metadata

For more information, see the following:


How to Define Metadata with EclipseLink SDOXSDHelper

You use the SDOXSDHelper to do the following:

  • Define SDO metadata, where SDO metadata is derived from XML schemas.
  • Generate XML schemas from SDO types.

You can customize metadata using the following annotations that you apply to the XML schema:

  • Standard annotations:
    • Information pending
  • EclipseLink annotations:
    • Information pending

You can also use various APIs to determine the XML representation about the SDO metadata.


How to Define Metadata with EclipseLink SDOTypeHelper

You use the SDOTypeHelper to do the following:

  • Look up SDO metadata.
  • Programmatically define SDO metadata (note that this is not the typical usage for the SDOTypeHelper).

Using Data

You can use the following EclipseLink SDO classes to work with data:


Using SDODataObject

A DataObject in SDO corresponds to a Java Object (POJO). To define object-XML mappings, you map the DataObject to XML. You can create your data object as either dynamic (see Dynamic DataObject Examples), or static by applying a type-safe interface to it (see Static DataObject Examples). The SDODataObject provides an XPath-like (see Mappings and XPath) means of data access. For example, the following code is valid in SDO:

customerDO.getDataObject("contact-info/phone-number[2]"); 

The standard JAXB, however, would require the following:

customer.getContactInfo().getPhoneNumbers().get(1); 

Note that you can use the EclipseLink XPathHelper to query data objects using an XPath expression.

For more information, see DataObject API


What You May Need to Know About Serialization in SDO

SDO has its own Java serialization format. The DataObject implements the Serializable interface.

Information pending.


Using SDOXMLDocument

When you marshall (save) a DataObject to XML, or unmarshall an XML document into objects, the XMLDocument class contains information about the root of the XML document.

For more information, seeSDOXMLDocument API.

What You May Need to Know About Sequence, ChangeSummary, and DataGraph

The following SDO classes... :(information pending)



Copyright Statement

Back to the top