User's Manual

Chapter 2.
WAF Component: Persistence
This chapter discusses the persistence layer in the overall Web Application Framework. This was
originally discussed in Section 1.2.4 Persistence. You can find persistence tutorials in Chapter 9 Per-
sistence Tutorial.
2.1. Persistence Overview
The storage and retrieval of persistent data is a common requirement of business applications. WAF
provides a persistence layer as a generic solution to this requirement.
The WAF persistence layer allows naturally written Java classes to be persisted to and queried from a
relational database. This is more than simply a method to save Java classes within the database. De-
velopers can use the full range of standard object-oriented modeling techniques, such as inheritance,
interfaces, polymorphism, associations, and composition when writing their Java classes.
WAF persistence is an example of an object-relational mapping layer. This chapter will discuss some
of the concepts required to understand and use WAF persistence. Examples and tutorials are detailed
in Chapter 9 Persistence Tutorial.
2.2. Object-Relational Mapping
An object-relational mapping layer allows developers to use both relational and object modeling in
the development of their applications.
Relational Modeling — a powerful tool for modeling knowledge. Modern relational databases uti-
lized with well designed relational schemas provide guaranteed data integrity, support for multiple
concurrent transactions, and support for fast and flexible querying.
Object modeling a powerful tool for modeling behavior. Object modeling is useful when coupled
with object-oriented (OO) languages and design patterns. OO languages are a common choice for
rapid application development and maintenance.
An object-relational mapping layer can automatically translate operations on an object model into
operations on a relational model and vice versa. This is accomplished through the use of map-
ping metadata that relates persistent attributes and associations in the object model with tables and
columns in the relational model.
2.3. Persistence Definition Language (PDL)
Because of the flexibility of both relational and object models, it is possible to map a given object
model to many different relational models and to map a single relational model to many different
object models.
WAF persistence uses a modeling and mapping language called Persistence Definition Language
(PDL) to allow developers to describe their object model, their relational model, and how the two
are mapped.
The metadata described in PDL allows the relational engine to efficiently persist changes to the object
model and to construct efficient SQL queries for performing object-level reads. PDL also allows
developers to define their own custom queries and SQL operations to do specialized querying and
updating of the relational model.