Difference between revisions of "EclipseLink/Examples/SDO/DynamicAPI"

From Eclipsepedia

Jump to: navigation, search
(Removing all content from page)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
==Creating DataObjects==
 +
===Using DataFactory===
 +
DataObjects can be created by Type using DataFactory:
 +
<source lang="java">
 +
Type customerType = TypeHelper.INSTANCE.getType("http://www.example.org/customer-example", "customer-type");
 +
DataObject customerDO = DataFactory.INSTANCE.create(customerType);
 +
</source>
  
 +
===Using DataObject===
 +
Once you have a DataObject you can use it to create child DataObjects based on its properties:
 +
<source lang="java">
 +
DataObject contactInfoDO = customerDO.createDataObject("contact-info");
 +
DataObject billingAddressDO = contactInfoDO.createDataObject("billing-address");
 +
</source>
 +
 +
==Getting/Setting Properties==
 +
An SDO path (similar to XPath) can be used with the String based accessors:
 +
<source lang="java">
 +
DataObject billingAddressDO = customerDO.getDataObject("contact-info/billing-address");
 +
</source>

Latest revision as of 17:01, 24 February 2009

Contents

[edit] Creating DataObjects

[edit] Using DataFactory

DataObjects can be created by Type using DataFactory:

Type customerType = TypeHelper.INSTANCE.getType("http://www.example.org/customer-example", "customer-type");
DataObject customerDO = DataFactory.INSTANCE.create(customerType);

[edit] Using DataObject

Once you have a DataObject you can use it to create child DataObjects based on its properties:

DataObject contactInfoDO = customerDO.createDataObject("contact-info");
DataObject billingAddressDO = contactInfoDO.createDataObject("billing-address");

[edit] Getting/Setting Properties

An SDO path (similar to XPath) can be used with the String based accessors:

DataObject billingAddressDO = customerDO.getDataObject("contact-info/billing-address");