name appears in the Match Class or
Package Name field, click the name to
select it, and then click OK to exit the
Search dialog box. Click OK again to
redisplay step 7 of 9 of the wizard.
6. Click Finish to close the view object creation wizard. In the WsDepartmentsView
.xml editor, click the Java menu.
7. Select the link next to the View Object
Class label to open the class in the Java
8. Move the cursor anywhere in the code
within the Java editor, right-click, and
choose Source -> Override Methods from
the context menu.
9. In the Override Methods dialog box,
check the Group By Class checkbox
to sort the methods by class. Locate
WsViewObject in the list, and select its
executeQuery ForCollection, and
getQueryHitCount methods. Be sure to
check the Copy Javadoc checkbox.
10. Click OK.
The generated file is now populated with
methods for accessing the JavaBean wrapper
class; the file includes comments (from the
template’s javadoc) that include override
For your own integration projects, this
is the approach you’ll take, overriding the
methods as needed. For the purposes of this
article, I’ve provided that code for you.
11. Open the viewObject-code-complete.txt
file, located in the views package, and
copy and paste its entire contents over
the entire WsDepartmentsViewImpl
class, replacing all the generated content.
12. Save your work, and close all the open tabs.
Oracle ADF enables application developers
to integrate Web services into their Business
Components applications at the service
layer, using a standard JAX-WS proxy client
in conjunction with programmatic entity and
At this point, you’ve created a programmatic
entity object and a custom view object that
uses the entity. To make these components
available to integrate the Web service with
the Business Components application, you
must expose the custom view object by
adding it to the application module. You can
also then test the integration. Starting from
the Application Navigator
1. Expand the AdfBcModel -> Application
Sources node and the oramag.sample
. application.model.services package.
2. Right-click the AppModule entry, and select
Open AppModule from the context menu.
3. In the AppModule.xml editor window,
click the Data Model menu.
4. In the Available View Objects field,
expand the oramag.sample.application
. model.views package and select
5. Click the right arrow to move the selected
view object to the Data Model list.
6. Right-click the WsDepartmentsView1
instance, and choose Rename from the
7. Rename the view object instance
all WsDepartments and click OK before
saving your work.
Assuming that the Web service you
deployed during initial setup is still running,
you can test the application by using the
Oracle JDeveloper component tester.
Right-click the AppModule entry in the
Application Navigator and choose Run from
the context menu to launch the Business
In the opened Oracle ADF Model Tester,
double-click the all WsDepartments instance
to read data from the Web service.
Click the arrows to browse and modify
the data, and see how the entity and view
objects you created populate the UI and
make changes to data on the Web service.
The Business Components project also con-
tains a pregenerated Employees entity and
view object that query employee data directly
from the database. As an advanced self-
study exercise, create an entity association
and view link between the WsDepartments
entity and the Employees entity, using
the DepartmentId attribute to define the
The completed-app workspaces include
this extra functionality as well as a model-driven list of values on the DepartmentId
attribute of the EmployeesView object (see
Figure 2). I encourage you to explore the code
and learn about these powerful features.
NEX T STEPS
Frank Nimphius is a senior principal product
manager for Oracle JDeveloper and Oracle
Application Development Framework. He is
a coauthor of Oracle Fusion Developer Guide:
Building Rich Internet Applications with Oracle
ADF Business Components and Oracle ADF
Faces (McGraw-Hill, 2010).
READ more about Oracle ADF
Oracle JDeveloper 11g
the sample application for this article
JULY/AUGUS T 2012 ORACLE. COM/ORACLEMAGAZINE