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)
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?
Posted by Todd Hill | April 6, 2008 8:00 PM
Posted on April 6, 2008 20:00
This was not done automagically. Only chance here is to do it manually.
Posted by Olaf Heimburger | April 10, 2008 7:26 AM
Posted on April 10, 2008 07:26