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/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_Java_User_Guide/Generated_Database_Keys ------------------------------------------------------------------------------ - Describe Tuscany/TuscanyJava/DAS Java Overview/RDBDAS Java User Guide/Generated Database Keys here. + The RDB DAS provides the ability to work with [http://en.wikipedia.org/wiki/Surrogate_key database generated keys]. A piece of configuration information , typically via a configuration XML file, is used to indicate to the DAS that a column value is generated by the database. This piece of information is necessary when new rows are inserted to the database since the DAS will generate an INSERT statement that does not include the generated column. + The follwing example illustrates the use of generated keys with the DAS: + + {{{ + DAS das = DAS.FACTORY.createDAS(getConfig("CompanyConfig.xml"), getConnection()); + Command select = das.getCommand("all companies"); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Flush changes + das.applyChanges(root); + + // Save the id + Integer id = (Integer) company.get("ID"); + }}} + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
