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/Examples/SDO/DynamicAPI"

(Creating DataObjects)
 
Line 12: Line 12:
 
DataObject contactInfoDO = customerDO.createDataObject("contact-info");
 
DataObject contactInfoDO = customerDO.createDataObject("contact-info");
 
DataObject billingAddressDO = contactInfoDO.createDataObject("billing-address");
 
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>
 
</source>

Latest revision as of 17:01, 24 February 2009

Creating DataObjects

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);

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");

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");

Back to the top