Explicit Create,Update,Delete

The RDB DAS provides a simple, command-oriented approach for CUD operations.

The Commands can be explicit INSERT, UPDATE , DELETE SQL statements like

  • INSERT INTO TableName (col1, col2,...) values (val1, val2,...);
  • DELETE FROM TableName where col1=? and col2=?...
  • UPDATE TableName set col1=val1, col2=val2...where col1=?...
    With this approach, the Command is directly used by the JDBC's PreparedStamement. This approach avoids use of SDO capabilities.

Below is example config.

<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd"> 

    <Command name="insert customer"    
    SQL="insert into CUSTOMER (ID, LASTNAME, ADDRESS) values (?, ?, ?)"
    <Command name="delete customer"    
	SQL="delete from CUSTOMER where ID = ?"

    <Command name="update customer"
        SQL="update CUSTOMER set LASTNAME = 'Pavick' where ID = ?"


Another way to perform the same operations is through use of SDO DataObjects. For this, the root DataObject needs to be formed either in static (DataObjectModel) or dynamic way (using Database Query's ResultSetMetaData). With the root DataObject in place, it uses, SDO APIs for DataObject and ChangeSummary to perform create, delete, update. For more details check (WorkingWithBasicCrud).

  • No labels