The shipment sample programs illustrate the use of BDB API of Berkeley DB with a shipment database, a familiar example from classic database texts.
See samples/db/index.html for information on how to compile and run the samples.
Each shipment sample illustrates the use of different types of bindings and data formats. They build on each other, but at the same time each sample stands alone in terms of both code and comments.
All samples use a modified form of Java serialization for the value bindings. Several samples use tuple format for key bindings since this provides a more compact key and deterministic sort order. Currently no samples show the use of tuples for value bindings although of course this is possible. The highest-level approach is illustrated by factory, which uses a built-in factory to create databases and collections.
The shipment samples illustrate a pattern for dividing responsibilities in applications that use BDB API.
Separating the data store and secondary index definitions from the view definitions is very important. This division allows easily defining more than one set of views on the same stored data.
For a larger program the division above may best be made along package lines rather than along class lines.