How to upgrade from ObjectDB 1.0?
Upgrade - Step By Step
To upgrade an existing application that uses ObjectDB 1.0 to ObjectDB 2.0:
- Replace the old ObjectDB and JDO jar files with the new objectdb.jar file. Make sure that the old jar files are removed from the classpath (check both the build classpath and the execution classpath). Refresh your IDE cache.
- Rebuild your project using the new jar file and enhance your classes using the new Enhancer.
Convert old database files using the ObjectDB converter:
> java -jar converter.jar <old-file-path> <new-file-path>
- Convert server configuration (if any) to the new configuration file format.
Effect on Existing Code
Please note the following changes in ObjectDB 2.0:
- ObjectDB 2.0 is more sensitive to failure to close a
PersistenceManagerFactory. The database is closed only when the
PersistenceManagerFactoryclosed, and until then changes might be applied only to the recovery file.
- ObjectDB 2.0 uses optimistic transactions by default (the default was datastore transactions in ObjectDB 1.0).
- In ObjectDB 2.0 classes can be either persistence capable (entity classes) or embeddable. To use embedded objects you must declare classes as embeddable (rather than the reference fields as in ObjectDB 1.0), either by annotation (
@Embeddablejavax.persistence.EmbeddableJPA annotationDefines a class whose instances are stored as an intrinsic part of an owning entity and share the identity of the entity.See JavaDoc Reference Page...) or by external XML metadata (
<class name="MyClass" embedded-only="true">in
- Changes to native arrays (
Object, etc.) are not tracked automatically by default.
- Not all the features of the old 1.0 Explorer are already supported.