Versions Compared

Key

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

...

For example, consider a database with the following table:

Panelcode

TABLE
CUSTOMER
ID INTEGER
LASTNAME
 CUSTOMER
     ID         INTEGER
     LASTNAME   VARCHAR(20)

ADDRESS

     ADDRESS    VARCHAR(30)

If an application uses the DAS to query this table with the following SQL statement:

...

The DAS will return a graph of DataObjects each of Type CUSTOMER and each instance in will have three properties: (ID, LASTNAME, ADDRESS). Here is the example code. Note that no configuration data is provided at all.

Code Blockpanel

DAS

das

=

DAS.FACTORY.createDAS(getConnection());


Command

readCustomers

=

das.createCommand("select

*

from

CUSTOMER");


DataObject

root

=

readCustomers.executeQuery();

Another piece of convention followed by the RDB DAS has to do with database table keys. When asked to "apply changes", the RDB DAS scans the SDO ChangeSummery and generates the set of INSERT/UPDATE and DELETE statements needed to flush the graph changes to the database. To generate the correct statements the RDB DAS needs to know how a DataObject's properties map to a database table key. In typical Object/Relational mappings frameworks, this information is provided in a config file with something like this:

...