ODB lost?

#1

I'm new to ObjectDB. While debugging small programs in single-step mode in NetBeans, the ODB appears to get corrupted or lost if I don't invoke close on EntityManager. If I re-run my program and get a new EntityManager, the instance behaves as if the data that was persisting is somehow gone.

I noticed in the file system, indeed, the .odb file is gone, but there are <name>_<v>.odb files where <name> is the name of my odb and <v> is apparently a version number. Is there any way to recover <name>.odb?

#2

ObjectDB closes open databases automatically on JVM shutdown, but apparently this is not done when using a debugger.

ObjectDB identifies a database file that was not closed by the existence of a special empty file (a file whose name is active in the odr directory). If this file exists when a database is opened - ObjectDB tries to restore the database file from the odr files (which represent transactions).

You can also restore the database explicitly by using the Replayer.

Also notice, that a bug that was fixed in version 2.1.1_01 caused renaming the ObjectDB database file by adding the _nonclosed suffix. This happened on attempt to open the same database simultaneously by different processes, which is common during debugging (when running the application again without ending the previous run).

In summary, you should:

  • Upgrade to the last build of ObjectDB.
  • Check if your database file exists with _nonclosed suffix.
  • If not found - rebuild the database by using the Replayer.
ObjectDB Support

Reply