This clearly shows that the BookItem with
id = 1 has been restocked and that the
Order has been added.

Should I Be Using Prevalence?

Let's be clear about this--I am not in any way suggesting that
everyone should abandon their databases and convert all their
projects to prevalent systems. In most cases, this would be neither
possible nor desirable. However, what I do suggest is that, in
certain circumstances, it is worth considering prevalence as a
simple alternative to using a database. The main characteristics of
a suitable application are:

There is a requirement for fault-tolerant data persistence.

The data will not be shared with other systems--since the
data is the business objects, it is very closely coupled to the
system.

There is not too much data--just how much is too much will
depend on hardware, but the data has to fit in working
memory.

The main advantages of using prevalence are:

Simplicity of code and configuration; ideal for
prototyping.

Performance.

The example system described here gives a flavor of how
Prevayler and Preclipse can be used to provide persistence for
business objects. Persistence is achieved without thinking of the
data in terms of anything other than the business objects
themselves--no database, no drivers, no schema definition
language, no queries, no mappings from classes to tables, and so
on. The persistent data is stored in a single folder that can be
backed up easily.

It is worth exploring further examples to see how different
types of applications can make use of prevalence. The Preclipse site
has an example of a GUI application built using the plugin, while
the Presto pet store example on the Prevayler site show how a web
application can make use of prevalence. In the latter case, the
prevalent system class is made an attribute of the application
server context so that it can be accessed from JSPs.