In summary, the Sleepycat Java Collections API tutorial has demonstrated how to create different types of bindings, as well as how to use the basic facilities of the Sleepycat Java Collections API: the environment, databases, secondary indices, collections, and transactions. The final approach illustrated by the last example program, Serializable Entity, uses tuple keys and serial entity values. Hopefully it is clear that any type of object-to-data binding may be implemented by an application and used along with standard Java collections.
The following table summarizes the differences between the examples in the tutorial.
Example | Key | Value | Entity | Comments |
---|---|---|---|---|
The Basic Program | Serial | Serial | No | The shipment program |
Using Secondary Indices and Foreign keys | Serial | Serial | No | Secondary indices and foreign keys |
Using Entity Classes | Serial | Serial | Yes | Combining the key and value in a single object |
Using Tuples | Tuple | Serial | Yes | Compact ordered keys |
Using Serializable Entities | Tuple | Serial | Yes | One serializable class for entities and values |
Having completed this tutorial, you may want to explore how other types of bindings can be implemented. The bindings shown in this tutorial are all external bindings, meaning that the data classes themselves contain none of the binding implementation. It is also possible to implement internal bindings, where the data classes implement the binding.
Internal bindings are called marshalled bindings in the Sleepycat Java Collections API, and in this model each data class implements a marshalling interface. A single external binding class that understands the marshalling interface is used to call the internal bindings of each data object, and therefore the overall model and API is unchanged. To learn about marshalled bindings, see the marshal and factory examples that came with your JE distribution (you can find them in <INSTALL_DIR>/examples/com/sleepycat/examples/collections/shipment where <INSTALL_DIR> is the location where you unpacked your JE distribution). These examples continue building on the example programs used in the tutorial. The Marshal program is the next program following the Serializable Entity program, and the Factory program follows the Marshal program. The source code comments in these examples explain their differences.