The class may also be extended to override the {@link #dataToObject(Object)} and {@link #objectToData(Object)} methods in order tomap between the deserialized objects and other objects. In that case the objects returned by the binding do not have to be serializable. Note that both methods must be overridden.
@author Mark HayesEntryBinding
that treats a key or data entry as a serialized object. This binding stores objects in serialized object format. The deserialized objects are returned by the binding, and their Class
must implement the Serializable
interface.
For key bindings, a tuple binding is usually a better choice than a serial binding. A tuple binding gives a reasonable sort order, and works with comparators in all cases -- see below.
WARNING: SerialBinding should not be used with Berkeley DB Java Edition for key bindings, when a custom comparator is used. In JE, comparators are instantiated and called internally at times when databases are not accessible. Because serial bindings depend on the class catalog database, a serial binding cannot be used during these times. An attempt to use a serial binding with a custom comparator will result in a NullPointerException during environment open or close.
{@code SerialBinding} and other classes in this package use standard Javaserialization and all rules of Java serialization apply. This includes the rules for class evolution. Once an instance of a class is stored, the class must maintain its {@code serialVersionUID} and follow the rules defined inthe Java specification. To use a new incompatible version of a class, a different {@link ClassCatalog} must be used or the class catalog databasemust be truncated.
If more advanced class evolution features are required, consider using the {@link com.sleepycat.persist.evolve Direct Persistence Layer}.
@author Mark Hayes
|
|