First page Back Continue Last page Text

oracle adf workshop


Updating or Removing an Existing Entity Row

You can add a method to update or remove a row. For example, you can add an application module method to update an employee row by performing the following steps:

1. Find the Employee by ID: This example assumes that you have defined a helper method named retrieveEmployeeById() that retrieves the EmployeeEO entity object by its primary key.

2. Set one or more attributes to new values: Use the setAttribute() method of the EntityImpl class to update the value of the Email attribute to the new value passed in.

3. Commit the transaction: Use the application module’s getDBTransaction() method to accesses the current transaction object and call its commit() method to commit the transaction.

The example for removing an entity row would be the same as this, except that after finding the existing entity, you would use the following line instead to remove the entity before committing the transaction: