« SDO Metadata API: The Business Value | Main | OSOA »

SDO Code Sample

I have had several requests for an SDO code sample. The SDO code samples below have been published elsewhere on the CodeFutures site, but I am providing them here as well for reference purposes.

If you really want a proper SDO code sample, the best way is to do an SDO download and generate your own SDO code sample using FireStorm/DAO

SDO Code Sample for Dynamic SDO API

DataGraph graph = db.executeQuery( “select * from customer” );
DataObject root = graph.getRootObject();

// use xpath to get the name of the first customer
String firstCustName = root.getString( “customer[0]/name” );

// iterate through all customers
Iterator iter = root.getList( “customer” ).iterator();
while (iter.hasNext()) {
DataObject dataObject = (DataObject) iter.next();
String custName = dataObject.getString( “name” );


SDO Code Sample for Static SDO API

In the SDO code sample below, customer is a generated class that extends DataObject).


// iterate through all customers
Iterator iter = root.getList( “customer” ).iterator();
while (iter.hasNext()) {
Customer customer = (Customer) iter.next();
String custName = customer.getName();


PJ Murray
CodeFutures Software


Additional Resources

TrackBack

TrackBack URL for this entry:
http://www.codefutures.com/cgi-bin/mt/mt-tb.cgi/61

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Recent Posts

Powered by
Movable Type 3.2