In general, persistence means that the data that is input into an application, either by a human user or by other means, will exist beyond the lifetime of the application. Even though the application may exit or the computer may shut down, the information will survive. This obviously is very important to an organization. Every small, medium, and large organization has the need to persist data.

Persisting Business Objects

When objects are created in memory for an application, they can’t stay there forever. Eventually, they must either be cleaned up or persisted to a data store. Memory is volatile, and an application might crash or need to be stopped for maintenance. Without data persistence, there’s no record to indicate what was ordered, for example, or whom to charge.

Business objects represent information that must be kept. To be of value, orders, items, and customer information must be persisted for an application like the Storefront. Losing a customer’s order is not going to make the customer a customer for long. Once the data has been persisted, it can be retrieved and used to reconstruct the business objects at a later time.

Storing Objects into a Relational Model

Although there are many different types of data stores, relational databases are used quite frequently to store the data for an organization, especially with applications like the Storefront. Relational databases are a necessity, and their use is widespread. There are, however, several obstacles that must ...

Get Programming Jakarta Struts, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.