Db4o Note: Db4o.configure() != Db4o.newConfiguration()

By Angsuman Chakraborty, Gaea News Network
Tuesday, August 19, 2008

In earlier versions of Db4o we used Db4o.configure() to configure all Db4o database globally (across all ObjectContainer). However in 7.2 (and above) versions of Db4o Db4o.configure() has been deprecated and it is suggested to use Db4o.newConfiguration() instead. Unfortuanately they do not clearly mention anywhere that these two functions are not equivalent. I assumed they are equivalent like Db4o.set()is equivalent Db4o.store() or Db4o.get() is equivalent to Db4o.queryByExample().

I lost couple of hours in the morning figuring this out and the other big Db4o gotcha. Db4o.newConfiguration() is a different beast altogether. You cannot just replace all calls to configuration() with newConfiguration().

Db4o.newConfiguration() creates a new set of configuration which you can use (after you configured it) to open a new ObjectContainer (database for others). Unless you use it to open a new database connection, it is just another Object configured with default values and does nothing. Db4o.openFile() now takes a configuration parameter.

This approach is more flexible as you can now configure each ObjectContainer separately.

Are you aware of any such big gotcha’s with recent version of Db4o?

will not be displayed