You are here: Advanced Features > Refactoring And Schema Evolution > Refactoring Class Hierarchy

Refactoring Class Hierarchy

db4o does not directly support the following two refactorings:

Note that interfaces don't influence the inheritance-hierarchy and can be added and removed at any time.

For example we've following classes:

 

In this example you cannot introduce a 'Animal' class above the 'Mammal' or add another class between 'Mammal' and 'Primate'. Also you shouldn't remove an class form the inheritance-hierarchy.

Currently the only possible solution for this refactoring is this.

  1. Create the new hierarchy with different names, preferably in a new package
  2. Copy all values from the old classes to the new classes.
  3. Redirect all references from existing objects to the new classes.

Take a look at the example to how to add a class into the hierarchy. See "Inserting Class Into A Hierarchy".

Or how you can remove a class from the inheritance hierarchy. See "Removing Class From A Hierarchy"