1.2. Lightweight Persistence

Persistent data is information that can
outlive the program that creates it. The majority of complex
programs use persistent data: GUI applications need to store user
preferences across program invocations, web applications track
user movements and orders over long periods of time, etc.

Lightweight persistence is the storage and
retrieval of persistent data with little or no work from you, the
developer. For example, Java serialization is a form of
lightweight persistence because it can be used to persist Java
objects directly to a file with very little effort. Serialization's
capabilities as a lightweight persistence mechanism pale, however, in
comparison to those provided by EJB. The next
chapter compares EJB to serialization and other available
persistence mechanisms.