May 19, 2019
Hot Topics:

Rapid J2EE Development with Oracle ADF

  • March 24, 2005
  • By Michael Klaene
  • Send Email »
  • More Articles »

In a push toward simplified J2EE, vendors have been unveiling rapid application development (RAD) tools at a furious pace. Today, for example, most integrated development environments (IDEs) provide wizards to generate the mundane and repetitive framework code necessary when building Model-View-Controller (MVC) applications. A good framework provides an easy, consistent (and preferably declarative) way to configure application components together. That framework should also enforce a 'clean seperation of concerns' that will enable you to switch the implementation for an individual layer without affecting the rest of the application. The Oracle Application Development Framework (ADF) is based upon J2EE design patterns, features from other proven frameworks such as Struts, and concepts borrowed from its own previous framework, Business Components for Java (BC4J). The goal of ADF is to conceal the complexities of J2EE, enabling developers to focus on business logic.

This article demonstrates how the ADF framework can be utilized to design a Web-based application. You will use the JDeveloper 10g IDE from Oracle. You can download a free version of it here. I'm also using the popular, open-source MySQL database that can be downloaded here. If you prefer to use Oracle's own database, the adjustments that you will need to make should be trivial.

Overview of ADF

In an effort to keep things simple, I want to avoid a detailed discussion of ADF. There are a number of existing demos and articles at the JDeveloper site. However, a high-level explanation of ADF components, and how they fit into the MVC architecture, is in order.



An ADF Entity object represents a business entity. This usually translates to a row of data in a table, and each Entity attribute represents a column in that table.

In ADF, an Entity handles other tasks, such as business validation and format masking. In most cases, the model is the most logical place to address these concerns because it will enable maximum reuse. Validations, predicated by business requirements, are likely to be relevant no matter how the model is used. For example, verifying that an employee is always assigned to one and only one department will not change if the application were converted from a Web application to a Swing application. ADF will propagate these validations and formats to the controller and view, alleviating the need for you to address these issues elsewhere.


An ADF View object exposes an Entity object to users of the application. An Entity may be accessed in numerous places, but the context in which it is used will vary. Filtering, sorting, and object relationships can be established by a view object, ensuring that the model is represented in a way that makes the most sense.

Application Module

The ADF Application Module bundles together View components, while providing access to your business services layer, which might use technologies such as EJB to manage your database. The Application Module provides ADF Views with transaction support, and other important data-centric services.

View and Controller

Nothing in your model should dictate a particular view technology. An Application Module can serve as the foundation for a Swing or Struts Web application. If developing a thick client application, Swing components might communicate directly with the application module. When developing a Web-based application, your application will use a clearly defined controller to manage model-view interaction.


In previous releases, ADF provided its own controller. That controller has since been replaced in favor of Struts. Struts uses an XML file, called struts-config.xml, to handle application requests and dispatch them to designated request handlers. Experienced Struts developers will appreciate the ability to leverage this existing knowledge.


JDeveloper makes it easy to visually design pages using JSP and JSTL. ADF also provides its own view framework, called UIX, that offers a set of HTML widgets for generating quick and consistent-looking view pages. You will be using UIX in this demonstration. UIX components will become the foundation for Oracle's JSF (JavaServer Faces) standard implementation in future releases.

Building a Sample Application

The application you will build allows employees to reserve conference rooms for work-related meetings. As I mentioned earlier, a MySQL database is used to create two tables, conference_rooms and room_reservations. The DDL to create these tables is listed below.

DROP TABLE IF EXISTS conference_rooms;

CREATE TABLE conference_rooms
   room_name         VARCHAR(32),
   number_of_seats   INTEGER,
PRIMARY KEY (room_id)

DROP TABLE IF EXISTS room_reservations;

CREATE TABLE room_reservations
   room_id           INTEGER NOT NULL,
   reservation_start DATETIME,
   reservation_end   DATETIME,
   reservation_team  VARCHAR(50),
PRIMARY KEY (reservation_id)

Start JDeveloper if you have not already done so. On the left, you will see the Applications-Navigator. Click the Connections tab to establish a connection to your MySQL database. Before doing this, however, it is necessary to make the MySQL JDBC driver available to JDeveloper and the embedded OC4J server you will use to run the application. You can do this by dropping the driver .jar file into the j2ee\home\applib directory of your JDeveloper home (ex. C:\jdev\j2ee\home\applib). Once complete, perform the following steps in the Applications-Navigator:

  • Select Database. Right-click, and choose New Database Connection... Click Next.
  • Enter 'MySQL' for Connection Name and select 'Third Party JDBC Driver' for Connection Type. Click Next.
  • The authentication page appears. Enter the username and password for your MySQL database. Check the Deploy Password checkbox, and then click Next.
  • Next, select the Driver Class 'com.mysql.jdbc.Driver' and enter a URL of 'jdbc:mysql://localhost/{database name}'. Click Next.
  • Click the Test Connection button. If connected, you will see 'Success'. Click Finish.

Page 1 of 3

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date