Apache ObJectRelationalBridge - OJB


Apache ObJectRelationalBridge (OJB) is an Object/Relational mapping tool that allows transparent persistence for Java Objects against relational databases.


OJB supports multiple persistence APIs to provide users with their API of choice:

  • A PersistenceBroker API which serves as the OJB persistence kernel. The OTM-, ODMG- and JDO-implementations are built on top of this kernel.
    This API can also be used directly by applications that don't need full fledged object level transactions. (See the Persistence Broker Tutorial for details.)
  • A full featured ODMG 3.0 compliant API. (See the ODMG Tutorial for an introduction.)
  • A JDO compliant API. We currently provide a plugin to the JDO Reference Implementation (RI). Combining the JDO RI and our plugin provides a JDO 1.0 compliant o/r solution.
    A full JDO implementation is scheduled for OJB 2.0. (See the JDO tutorial for an introduction to the JDO programming model.)
  • An Object Transaction Manager (OTM) layer that contains all features that JDO and ODMG have in common. (See the OTM tutorial for details).

See the FAQ for a detailed view of the OJB layering. Get the latest information on each API's status.


OJB has been designed for a large range of applications, from embedded systems to rich client application to multi-tier J2EE based architectures.

OJB integrates smoothly into J2EE Application servers. It supports JNDI lookup of datasources. It ships with full JTA and JCA integration. OJB can be used within JSPs, Servlets and SessionBeans. OJB provides special support for Bean Managed EntityBeans (BMP).


OJB uses an XML based Object/Relational mapping. The mapping resides in a dynamic MetaData layer, which can be manipulated at runtime through a simple Meta-Object-Protocol (MOP) to change the behaviour of the persistence kernel.

OJB provides several advanced O/R features like Object Caching, lazy materialization through virtual proxies and distributed lock-management with configurable Transaction-Isolation levels. Optimistic and pessimistic locking is supported.

OJB provides a flexible configuration and plugin mechanism that allows to select from set of predefined components or to implement your own extensions and plugins.

A more complete featurelist can be found here.

Learn more about the OJB design principles in this document.