Java Data Objects (JDO)
The Java Data Objects (JDO) specification is part of the Sun Java Community Process. JDO is a Java application program interface (API) for transparent persistence. It works with both object and relational databases as well as other types of systems. It is designed to also work well with EJB and J2EE.
The JDO object model is determined by a set of Java classes and XML metadata file. The metadata file contains modeling directives that either override the semantics specified in Java or provides semantics that cannot be expressed in Java. An enhancer is provided that enhances the Java classes based on these modeling directives.
The JDO specification provides a standard interface for accessing, storing, and processing persistent objects. The primary aspects in the JDO model are:
- PersistenceManager: PersistenceManagers negotiate accesses, transactions, and queries between applications and the underlying data store. More on the JDO PersistenceManager.
- Transaction: Transactions provide for atomic, consistent, isolated, and durable management of data (ACID properties). More on ACID properties.
- Query: The JDO Query Language (JDOQL) allows users to search for persistent objects matching specific criteria. JDOQL is meant to be query language neutral so that the underlying query language could be SQL, an object database query language such as OQL, or a specialize API to a hierarchical database or EIS system. More on the JDO Query Language.
- PersistenceCapable classes: The actual entities that are stored and fetched. There are three identity models to allow for different underlying database management systems. More on JDO identity models.
The JDO specification uses the Java language as much as possible, which allows the transparent integration of Java. This is illustrated by the following diagram and contrasts with the database sublanguage of SQL and its variants. In this diagram, you only see the host programming language and no database sublanguage or call-level interface as in JDBC.
An example of a host statement in Java that creates a new Person instance would be:
person = new Person();
person.ssan = "999999999";
person.name = "Doug Barry";
This code fragment would be all the code necessary to create a new person. There is no database sublanguage or call interface. If you wanted to manipulate this object in Java, you could use the object directly. Also see transparent persistence vs. JDBC call-level interface.
For more information on transparent persistence, see:
- Transparent persistence for object databases
- Transparent persistence for relational databases using object-relational mapping products
For examples of JDO code, see
More detail for the current topic: Java Data Objects (JDO)
More on the general topic: DBMS Standards
- ODMG 3.0
- Detailed Comparison of ODMG 3.0 and JDO
- Summary Comparison of DBMS Standards