How can I update a database automatically with databound components?

You can update your database automatically when you bind the visual Editable UI components to a rowset. When a database table is dragged and dropped onto a Page or Component, a DataProvider is created in the Page and a RowSet is created in the SessionBean. The DataProvider wraps the RowSet. The RowSet is set by default for CONCUR_UPDATEABLE. It is now quite easy to use the DataProvider API to perform various database actions on the RowSet. For example:

   * tripDataprovider.appendRow() - adds a blank to the rowset
   * tripDataProvider.removeRow(rowKey) - marks the row identified by rowkey for deletion
   * tripDataProvider.commitChanges() - applies all the changes to the rowset to the database. All users inputs/changes via components are automatically applied to rowset via databinding
   * tripDataProvider.release() - uncaches the database rows retrieved
   * tripDataProvider.refresh() - re-executes the SQL Query to retrieve database rows

Refer to the Using Databound Components to Access Databases and Performing Inserts, Updates, and Deletes tutorials for more information on how to perform database updates via component databinding.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo