Library Version 12.1.6.2

Registering DPL Secondary Keys
Prev | Chapter 16. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8 | Next

## Registering DPL Secondary Keys

Entity subclasses that define secondary keys must now be registered prior to storing an instance of the class. This can be done in two ways:

- The `EntityModel.registerClass()` method may be called to register the subclass before opening the entity store.

- The `EntityStore.getSubclassIndex()` method may be called to implicitly register the subclass after opening the entity store.

Failure to register the entity subclass will result in an `IllegalArgumentException` the first time an attempt is made to store an instance of the subclass. An exception will not occur if instances of the subclass have previously been stored, which allows existing applications to run unmodified in most cases.

This behavioral change was made to increase reliability. In several cases, registering an entity subclass has been necessary as a workaround. The requirement to register the subclass will ensure that such errors do not occur in deployed applications.

Prev | Up | Next
Chapter 16. Upgrading Berkeley DB 4.7 applications to Berkeley DB 4.8 | Home | Minor Change in Behavior of DB_MPOOLFILE->get