The goal of this sample application is to demonstrate how to a ADF Business Components application can use database stored procedures to select, update, insert, and delete data.
You must have JDeveloper 10 g and access to the Oracle common schema. To install the Oracle9i common schema on a earlier version of the database following these instructions.
You must also run the included SQL script (stproc.sql) using the hr_conn connection. To do this in JDeveloper, you must have SQL*Plus installed.
Model project in the Application Navigator.stproc.sql.If you don't have SQL*Plus installed, you could also use the SQL Worksheet available in JDeveloper.
This script is designed for the Oracle database. It may not work on other databases.
To run the sample right-click on the Model project and select Run from the context menu.
The Model project was created using the simple ADF Business Components wizards available in the new gallery. The doDML() and doSelect() methods were written using the code editor.
The key point in this sample application is to understand how to override doDML() and doSelect() in the entity object to use stored procedures. You may want to do this if you have existing stored procedures that you want to use, rather than using the default ADF BC methods for working with your data.
To see how this is done, open DepartmentsImpl.java in the code
editor. You can do this by selecting the Departments entity
object in the Model project, Then, in the structure
pane, double-clicking on DepartmentsImpl.java. Look closely at doSelect() at
line 127 and doDML() at line 135. Notice they use helper functions
defined further down in the file. That's a good practice to keep the logic
of doSelect() and doDML() clear, while still allowing
you to write complex functions to work with your data.
Here are a few things you could do now that you understand this sample.