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.
Difference between revisions of "EclipseLink/UserGuide/SDO/Using EclipseLink SDO (ELUG)"
m (→Using XMLHelper) |
m (→Performing Actions on Data Objects at Run Time) |
||
Line 36: | Line 36: | ||
Using the EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOHelperContext.html SDOHelperContext]</tt> <tt>makeDefaultContext</tt> method, you can promote your local context to become the global (default) one. | Using the EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOHelperContext.html SDOHelperContext]</tt> <tt>makeDefaultContext</tt> method, you can promote your local context to become the global (default) one. | ||
+ | |||
+ | |||
===Using DataFactory=== | ===Using DataFactory=== | ||
You use the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/DataFactory.html DataFactory]</tt> to create disconnected instances of a <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/DataObject.html DataObject]</tt>. That is, the newly created <tt>DataObject</tt> instances have no set properties and no container. | You use the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/DataFactory.html DataFactory]</tt> to create disconnected instances of a <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/DataObject.html DataObject]</tt>. That is, the newly created <tt>DataObject</tt> instances have no set properties and no container. | ||
− | You can obtain the <tt>DataFactory</tt> from the <tt>HelperContext</tt> | + | You can obtain the default <tt>DataFactory</tt> from the <tt>INSTANCE</tt> field or from the <tt>getDataFactory</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. |
+ | |||
+ | You can also define and retrieve the <tt>HelperContext</tt> from your EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDODataFactory.html SDODataFactory]</tt>. | ||
For more information, see the following: | For more information, see the following: | ||
* EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDODataFactory.html SDODataFactory]</tt> API | * EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDODataFactory.html SDODataFactory]</tt> API | ||
* EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#DataFactory_-_Create_DataObjects DataFactory]</tt> examples | * EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#DataFactory_-_Create_DataObjects DataFactory]</tt> examples | ||
+ | |||
Line 50: | Line 55: | ||
You use the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLHelper.html XMLHelper]</tt> to convert XML documents into data objects, and vice versa. The two main operations of the <tt>XMLHelper</tt> are <tt>load</tt> and <tt>save</tt>. | You use the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/XMLHelper.html XMLHelper]</tt> to convert XML documents into data objects, and vice versa. The two main operations of the <tt>XMLHelper</tt> are <tt>load</tt> and <tt>save</tt>. | ||
− | You can obtain the default <tt>XMLHelper</tt> from the <tt>INSTANCE</tt> field or from the <tt>getXMLHelper</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. | + | You can obtain the default <tt>XMLHelper</tt> from the <tt>INSTANCE</tt> field or from the <tt>getXMLHelper</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. |
− | The EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOXMLHelper.html SDOXMLHelper]</tt> <tt>initializeDescriptor</tt> | + | The EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOXMLHelper.html SDOXMLHelper]</tt> <tt>initializeDescriptor</tt> method allows you to define an [[Introduction_to_XML_Descriptors_%28ELUG%29 | XML descriptor]] for your application. |
For more information, see the following: | For more information, see the following: | ||
* EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOXMLHelper.html SDOXMLHelper]</tt> API | * EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOXMLHelper.html SDOXMLHelper]</tt> API | ||
* EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#XMLHelper_-_Handle_XML_Data_as_DataObjects XMLHelper]</tt> examples | * EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#XMLHelper_-_Handle_XML_Data_as_DataObjects XMLHelper]</tt> examples | ||
+ | |||
+ | |||
===Using DataHelper=== | ===Using DataHelper=== | ||
− | + | The main purpose of the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/DataHelper.html DataHelper]</tt> is to enable conversion of values used with data objects between data types. | |
+ | |||
+ | You can obtain the default <tt>DataHelper</tt> from the <tt>INSTANCE</tt> field or from the <tt>getDataHelper</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. | ||
+ | |||
+ | You can also define and retrieve the <tt>HelperContext</tt> from your EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDODataHelper.html SDODataHelper]</tt>. | ||
+ | |||
+ | For more information, see the following: | ||
+ | * EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDODataHelper.html SDODataHelper]</tt> API | ||
+ | * EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#DataHelper_-_Convert_Simple_Values DataHelper]</tt> examples | ||
===Using CopyHelper=== | ===Using CopyHelper=== | ||
− | + | You use the <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/CopyHelper.html CopyHelper]</tt> to create the following types of copies of data objects: | |
+ | * a copy of a <tt>DataObject</tt>'s values with <tt>DataType</tt> properties; | ||
+ | * a copy of a tree of <tt>DataObject</tt> instances. | ||
+ | |||
+ | You can obtain the default <tt>CopyHelper</tt> from the <tt>INSTANCE</tt> field or from the <tt>getCopyHelper</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. | ||
+ | |||
+ | You can also define and retrieve the <tt>HelperContext</tt> from your EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOCopyHelper.html SDOCopyHelper]</tt>. | ||
+ | |||
+ | For more information, see the following: | ||
+ | * EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOCopyHelper.html SDOCopyHelper]</tt> API | ||
+ | * EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#CopyHelper_-_Create_Copies_of_DataObjects CopyHelper]</tt> examples | ||
===Using EqualityHelper=== | ===Using EqualityHelper=== | ||
− | + | An <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/EqualityHelper.html EqualityHelper]</tt> provides methods to compare data objects and let you determine the following: | |
+ | * whether or not two <tt>DataObject</tt> instances have the same values for their <tt>DataType</tt> properties; | ||
+ | * whether or not two trees of data objects are equal. | ||
+ | |||
+ | You can obtain the default <tt>EqualityHelper</tt> from the <tt>INSTANCE</tt> field or from the <tt>getEqualityHelper</tt> method of the default <tt>[http://www.eclipse.org/eclipselink/api/1.1/commonj/sdo/helper/HelperContext.html HelperContext]</tt>. | ||
+ | |||
+ | You can also define and retrieve the <tt>HelperContext</tt> from your EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOEqualityHelper.html SDOEqualityHelper]</tt>. | ||
+ | |||
+ | For more information, see the following: | ||
+ | * EclipseLink <tt>[http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/sdo/helper/SDOEqualityHelper.html SDOEqualityHelper]</tt> API | ||
+ | * EclipseLink <tt>[http://wiki.eclipse.org/EclipseLink/Examples/SDO/BasicAPI#EqualityHelper_-_Compare_DataObjects EqualityHelper]</tt> examples | ||
==Generating Static SDO Classes at Design Time== | ==Generating Static SDO Classes at Design Time== |
Revision as of 11:49, 30 April 2009
This section explains where and how you use EclipseLink SDO to customize your application to meet requirements.
Contents
Performing Actions on Data Objects at Run Time
Use the following classes to perform actions on your data objects:
For more information, see EclipseLink SDO examples.
Using HelperContext
SDO defines a HelperContext interface. You use it to access related SDO helper classes that let you perform common operations such as reading and writing XML documents, defining SDO types from XML Schema, and so on.
To obtain a default context, call the HelperProvider getDefaultContext method.
You can create the local context provided by EclipseLink as follows:
HelperContext helperContext = new SDOHelperContext();
For more information, see the following:
- EclipseLink SDOHelperContext API
- EclipseLink HelperContext examples
What You May Need to Know About Local and Global HelperContext
All the helpers that you can retrieve using accessor methods or instance fields of the global HelperContext have visibility to the global SDO metadata, that is, their scope of execution is global.
The opposite is true for the local HelperContext, such as the SDOHelperContext provided by EclipseLink: you can use it to obtain helpers that have visibility to the local SDO metadata.
Using the EclipseLink SDOHelperContext makeDefaultContext method, you can promote your local context to become the global (default) one.
Using DataFactory
You use the DataFactory to create disconnected instances of a DataObject. That is, the newly created DataObject instances have no set properties and no container.
You can obtain the default DataFactory from the INSTANCE field or from the getDataFactory method of the default HelperContext.
You can also define and retrieve the HelperContext from your EclipseLink SDODataFactory.
For more information, see the following:
- EclipseLink SDODataFactory API
- EclipseLink DataFactory examples
Using XMLHelper
You use the XMLHelper to convert XML documents into data objects, and vice versa. The two main operations of the XMLHelper are load and save.
You can obtain the default XMLHelper from the INSTANCE field or from the getXMLHelper method of the default HelperContext.
The EclipseLink SDOXMLHelper initializeDescriptor method allows you to define an XML descriptor for your application.
For more information, see the following:
- EclipseLink SDOXMLHelper API
- EclipseLink XMLHelper examples
Using DataHelper
The main purpose of the DataHelper is to enable conversion of values used with data objects between data types.
You can obtain the default DataHelper from the INSTANCE field or from the getDataHelper method of the default HelperContext.
You can also define and retrieve the HelperContext from your EclipseLink SDODataHelper.
For more information, see the following:
- EclipseLink SDODataHelper API
- EclipseLink DataHelper examples
Using CopyHelper
You use the CopyHelper to create the following types of copies of data objects:
- a copy of a DataObject's values with DataType properties;
- a copy of a tree of DataObject instances.
You can obtain the default CopyHelper from the INSTANCE field or from the getCopyHelper method of the default HelperContext.
You can also define and retrieve the HelperContext from your EclipseLink SDOCopyHelper.
For more information, see the following:
- EclipseLink SDOCopyHelper API
- EclipseLink CopyHelper examples
Using EqualityHelper
An EqualityHelper provides methods to compare data objects and let you determine the following:
- whether or not two DataObject instances have the same values for their DataType properties;
- whether or not two trees of data objects are equal.
You can obtain the default EqualityHelper from the INSTANCE field or from the getEqualityHelper method of the default HelperContext.
You can also define and retrieve the HelperContext from your EclipseLink SDOEqualityHelper.
For more information, see the following:
- EclipseLink SDOEqualityHelper API
- EclipseLink EqualityHelper examples
Generating Static SDO Classes at Design Time
Information pending
Performing Integration
Information pending
Integrating SDO with JAXB
Information pending
Integrating SDO with JPA
Information pending
Using SDO as a Web Service Binding Layer
Information pending
How to Use Web Service Attachments
Information pending
Executing XPath with XML
Information pending