Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

WorkingWithRelationships

As mentioned elsewhere in this guide, the RDB DAS provides a simple, implicit mapping from SDO Types/Properties to Relational Tables/Columns. So, in the absence of configuration to the otherwise, reading a table named CUSTOMER with columns NAME and ADDRESS will result in a data graph containing SDO DataObjects of Type CUSTOMER with properties NAME and ADDRESS.

...

DataObjectPtr root = select->executeQuery();
DataObjectPtr customer = root->getDataObject("customer\CUSTOMER[1\]");
DataObjectList& orders = customer->getList("ordersORDERS");

delete das; 

Panel

DASImpl* das = (DASImpl*) DASImpl::getFactory().createDAS(Config("CustomerOrderConfig.xml"), getConnection());
// Read some customers and related orders
CommandPtr select = das->createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1");

Wiki Markup

You can see that the client can work with the data graph as a set of related objects. Once the application has a handle to a customer, it can reference that customers related orders by accessing the customers "orders" property.

...

As a side note, the config in this example is not required since the table definitions follow a "convention" recognized by the DAS. See WorkingWithConventions\.