Make class names independent via db4o renaming api

110 Views Asked by At

I'm new in Db4o

As far as I checked, when I do a refactoring of a class name or path (packages), db4o doesnt recognizes the class anymore and creates a new 'category'.

I want to make an API, so that any class refactoring in my app won't affect the database. I've created the following function ...

public void saveClassAs(Class objClass, String nameInDB){
   configuration.common().objectClass(objClass).rename(nameInDB);
}

and have it called for each of my classes. Since the nameInDB will be constant for each class, no matter where the class is located or its name.

The problem is that Im not sure if will this work and I don't know if this is a good idea in matters of speed ... I didn't find any details on db4o documentation about how the renaming API works. Any help?

1

There are 1 best solutions below

1
On

If you want to use constant class names (irrespective to the real classes names) my best bet is to use aliases.

Regarding renaming configuration you can find details here.