2011/01/16 - Apache ObJectRelationalBridge has been retired.

For more information, please explore the Attic.


OJB - Features

  • Supports both standard- and non-standard APIs:
    • PB API (non-standard)
    • ODMG API (standard)
    • OTM API (non-standard)
    • JDO API (standard)
  • The PersistenceBroker kernel API and all top-level APIs (ODMG, OTM, JDO) allows Java Programmers to store and retrieve Java Objects in/from (any) JDBC-compliant RDBMS
  • Transparent persistence: classes does not have to inherit from any OJB base class nor implement a special interface. OJB delivers pure transparent persistence for POJOs.
  • Scalable architecture that allows to build massively distributed and clustered systems.
  • Configurable persistence by reachability: All Objects associated to a persistent object by references can made persitent too.
  • Extremly flexible design with pluggable implementation of most service classes like PersistenceBroker, ObjectCache, SequenceManager, RowReader, ConnectionFactory, ConnectionManager, IndirectionHandler, SQLGenerator, JdbcAccess, ... and so on.
  • Quality assurance taken seriously: More than 800 JUnit Test Cases for regression tests. JUnit tests are integrated into the build scripts and used as quality assurance for daily development.
  • Mapping support for 1:1, 1:n and m:n associations.
  • Configurable collection queries to control loading of relationships. See QueryCustomizer.
  • Automatic and manual assignment of foreign key values.
  • The Object / Relational mapping is defined in an XML Repository. The mapping is completely dynamic and can be manipulated at runtime for maximum flexibility
  • Easy use of multiple databases.
  • Configurable Lazy Materialization through Proxy support in the PersistenceBroker. The user can implement specific Proxy classes or let OJB generate dynamic Proxies.
  • Support for Polymorphism and Extents. You can use Interface-types and abstract classes as attribute types in your persistent classes. Queries are also aware of extents: A query against a baseclass or interface will return matches from derived classes, even if they are mapped to different DB-tables
  • Support for Java Array- and Collection-attributes in persistent classes. The attribute-types can be Arrays, java.util.Collection or may be user defined collections that implement the interface ojb.broker.ManageableCollection.
  • Sequence-Managing . The SequenceManager is aware of "extents" and maintains uniqueness of ids accross any number of tables. Sequence Numbering can be declared in the mappping repository.
    Native Database based Sequence Numbering is also supported.
  • Reusing Prepared Statements, internal connection pooling.
  • Integrates smoothly in controlled environments like EJB containers
  • Full JTA and JCA (in progress) Integration.
  • Support for prefetched relationships to minimize the number of queries.
  • ODMG compliant API, a Tutorial, and TestCases are included.
  • JDO 1.0.1 compliant API (based on jdori, native implementation in progress), a Tutorial, and TestCases are included.
  • The Lockmanagement supporting four pessimistic Transaction Isolation Levels (uncommited or "dirty" reads, commited reads, repeatable reads, serializable transactions) - distributed locking is possible.
  • Optimistic locking support. Users may declare int or long fields as version attributes or java.sql.Timestamp fields as timestamp attributes.
  • Support for persistent object caching. Different caching strategies and distributed caches.
  • Comes along with fully functional demo applications running against HSQLDB.
  • Provides Commons-Logging and Log4J logging facilities.
  • 100%: pure Java, Open Source, Apache License


- OQL is currently not fully implemented (Aggregations and Method Invocations)
- ODMG implicit locking is partly implemented but does currently not maintain transaction isolation properly. To achieve safe transaction isolation client applications must use explicit lock acquisition.

by Thomas Mahler, Armin Waibel