« ADF in Action: Content of the Database Project, Iteration 1 | Main | ADF in Action: Building the Model Layer with EJB 3 »

ADF in Action: The Model Layer

Application Layers

Modern computer applications are composed of several layers to make the different application tasks better manageable. The most prominent and widely used ... is the Model-View-Controller (MVC) Pattern. This pattern was introduced by the Smalltalk language. The MVC is one of the best understood and widely used implementation strategies. The same applies to most ADF applications and we will use it in this series as well.

The Model Layer

After having completed the database model, it is time to have some thoughts about the model layer. The model layer acts as the data holding layer. It arranges the data objects with their attributes and relationships. Methods for adding, deleting and modifying these objects are supplied. Very often this layer also supplies methods for retrieving and persisting the data.

Model Layer Choices

Oracle ADF supports many ways to implement the model layer. We will have a look at these three possible choices:
  • EJB 3.0 / Java Persistence API (JPA)
  • TopLink
  • ADF Business Components
Each of these choices deserves a separate coverage as they tend to be different in many ways.

General Considerations

Before we go into the details we have to consider some things:
  • Plural vs Singular Naming - Database designers use conventions different from Java designers. Most visible is the naming convention. While database designers use plural names, Java designers use singular names. The Model Layer should take care of that.
  • Using Existing Sequence Generators - To make the database model as useful as possible Oracle database designers often use Sequences for generating primary keys. This is particularly useful if more than one application accesses the database. The model layer should be able to use the existing Sequences.

Comments (2)

Todd Hill:

Under Step 3: Check the generated files, none of the @SequenceGenerator annotations were created, so correspondingly I was not prompted during code generation. Did I miss a step? I do have the Sequences and Tables in my SURVEY schema.

But then I'm not sure how Oracle knows that SEQ_ANSWERS is the sequence for the ANSWERS table by looking at the properties in the XE database browser. Can you explain?

Olaf Heimburger:

This was not done automagically. Only chance here is to do it manually.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on March 31, 2008 4:21 PM.

The previous post in this blog was ADF in Action: Content of the Database Project, Iteration 1.

The next post in this blog is ADF in Action: Building the Model Layer with EJB 3.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle