Chapter 9

Persistent Objects

Most programs have a common problem: they want to save part of their state, (i.e., part of their objects), in certain moments to make sure they survive the end of the program run. This process is called persisting. In another moment, and frequently in another program run, persistent objects should eventually be taken back from their exile to operative use.

There are many options to make data and objects “durable” in Java. Typical variants include:

Persistence mechanisms

image Saving the object attributes to a file(e.g., in XML format).

 Serialization of an object graph in a stream.

 Saving the objects to a relational ...

Get Unit Testing in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.