Martian Software, Inc. logo

Trivial Persist: an incredibly simple Java object persistence mechanism

March 13, 2008

Update 3/13/08: This project is retired.

Trivial Persist was developed to provide the quickest and easiest means possible to object persistence in Java. That means no cumbersome XML files to glue things together, no SQL database at all, and use of normal Java classes for access - normal as in Set, Comparator, Iterator - rather than JDBC or a new API. As a result, a new object repository (called a Store) can be created or modified in just a few seconds.

Trivial Persist keeps all objects in memory at all times, and writes any changes through to disk upon calling a Record's save() method. It is not designed for huge databases.

Basic type checking on data fields is handled automatically. More sophisticated Record validation is easily added by the developer. Custom RecordInitializers can be created to perform tasks when new Records are created (for example, populating them with default values).

Each record is stored to disk in java.util.Properties format, allowing it to be read or edited using simple text manipulation tools. In other words, you can easily search your Store from the command line using grep, or edit records using your favorite text editor.

Record files are named in the same manner as those in qmail Maildirs. Although Trivial Persist cannot yet detect or handle changes to Record files by external processes, it is planned for the next release. The Maildir format was chosen specifically because it handles file modifications by multiple processes quite well.

For a quick overview of Trivial Persist, see the Manual. For more detailed information, see the javadocs.


Copyright (c) 2004, Marty Lamb. All rights reserved.

Trivial Persist is licensed under the Lesser GNU Public License. A copy of this license is available at

Note: There has been much discussion recently regarding the LGPL and Java-based projects. As a result, the following LGPL clarification applies (based upon a similar clarification at

Trivial Persist is Free Software. The LGPL license is sufficiently flexible to allow the use of Trivial Persist in both open source and commercial projects. Using Trivial Persist (by importing Trivial Persist's public interfaces in your Java code), and extending Trivial Persist (by subclassing) are considered by the authors of Trivial Persist to be dynamic linking. Hence our interpretation of the LGPL is that the use of the unmodified Trivial Persist source or binary, or the rebundling of unmodified Trivial Persist classes into your program's .jar file, does not affect the license of your application code.

If you modify Trivial Persist and redistribute your modifications, the LGPL applies.