Berkeley DB XML Reference Guide:
Upgrading Berkeley DB XML Applications

PrevRefNext

Migrating Berkeley DB XML Java Applications

The Java interface to Berkeley DB XML is similar to the C++ interface in spirit. In addition to the changes to the interface due to functional changes in Berkeley DB XML, the Java interface has changed to be more compatible with the Berkeley DB Java interface.

XmlManager and Environment

The Berkeley DB Java interface replaces the DbEnv object with an Environment object. It also replaces the DbTxn object with Transaction. The interface also replaces the use of integer flags with configuration objects. Berkeley DB XML has adopted this mechanism as well.

Configuration Object

There are 3 new configuration objects in Berkeley DB XML, replacing corresponding use of flags:

  1. XmlManagerConfig: use this object to configure a new XmlManager object.

  2. XmlContainerConfig: use this object to configure XmlContainer objects. A default XmlContainerConfig object can be set on an XmlManager object that affects all containers it creates and opens. This object extends DatabaseConfig, and inherits state, such as encryption, read isolation level, threading configuration, and read-only.

  3. XmlDocumentConfig: use this object to configure XmlDocument-level state, such as DBXML_LAZY_DOCS or DBXML_GEN_NAME (C++ flags).

Delete, GC and Object Life Cycle

The Java XmlManager and XmlContainer objects have close() methods on them, to ensure closing of their underlying database state. They also have delete() methods, which clean up native C++ state. If there are no other object references, deleting an XmlContainer or XmlManager is the equivalent of close(). It can be safer to call close().


PrevRefNext

Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.