Dear Wiki user, You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.
The following page has been changed by KevinWilliams: http://wiki.apache.org/ws/WorkingWithRelationships ------------------------------------------------------------------------------ - Describe WorkingWithRelationships here. + As metnioned elswhere 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. + This is great for reading entities from a single table but clients often need to read data from related tables for example Customers and their related Orders. The RDB DAS can work with related database tables and reads that span tables produce graphs of related data objects. Continuing with our Customer->Order example, a client can read a set of Customers and related Orders by using a SELECT statement that includes a join. The client must also provide some mapping information in the configuration file to define to the DAS how the queried tables are related. + + {{{ + String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER " + "ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; + + DAS das = DAS.FACTORY.createDAS(getConfig("CustomerOrderConfig.xml"), getConnection()); + // Read some customers and related orders + Command select = das.createCommand(statement); + + DataObject root = select.executeQuery(); + DataObject customer = root.getDataObject("CUSTOMER[1]"); + + assertEquals(2, customer.getList("orders").size()); + + }}} + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
