
In fact, Java already has a well-established, built-in persistence mechanism in the form of serialization. However, serialization is limited in terms of ability to query specific data, and, crucially, in its lack of fault tolerance. The first problem is not an issue if the entire data set for an application can be held in memory--and querying an in-memory data set will usually be faster than a database query. However, this is not of much use if the system experiences a failure while running--the state of the data on restart will be the last serialized data set, and any changes to the data since then will be lost.
