RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Java Data Objects (JDO): An Object-based Approach to Transparent Persistence

For persistence storages, JDO provides a better and more efficient approach to application development.


hese days almost every application requires some sort of data persistence, whether local, remote, or both. Developers traditionally have built applications with a specific data store and source in mind, using data store-specific APIs. This approach becomes troublesome and resource-intensive when trying to support and certify an application on numerous persistent data stores. Still, developers have had no choice but to learn, code, and test data source-specific APIs, despite the significant added overhead in the product lifecycle.

The JDO specification defines a set of Java APIs that exposes a consistent model to programmers interacting with disparate data sources.

For persistence storages like file systems, RDMSs, and object-oriented databases, Java Data Objects (JDO) provides a better and more efficient approach to application development. JDO provides developers with another layer of abstraction that encapsulates data store-specific details, letting application programmers concentrate on business logic rather than persistence storage intricacies. JDO provides a Java object interface to the data source, so developers perform data operations the same way they treat any other Java object. The result is faster application development (read quicker time to market) and fewer worries about persistent data storage.

JDO Overview
The two main goals of the JDO specification are to provide:

  • For application developers: A consistent Java-object-model-centric view of permanent data stores, whether local or networked.
  • For software vendors: Detailed contracts and clear declarations of roles and responsibilities for application servers and JDO implementation providers so that various data stores can be plugged seamlessly into their applications.
    Figure 1 | A typical JDO-based application scenario

    JDO addresses not only enterprise data, but also persistent data in general (even in embedded systems). In a two-tier environment, JDO hides the details of data storage, types, relationships, and retrieval. In the more complex managed multi-tier environment JDO also handles concurrency issues, transactions, scalability, security, and connection management.

    Figure 1 depicts a typical JDO-based application scenario.

    JDO relies on the J2EE Connector architecture (JCA) for EIS access and uses the Java Transaction API (JTA) for distributed transactions. A JDO instance is a persistence-capable (implements PersistenceCapable interface) class, each instance of which represents some form of persistent data. You can make a Java class persistence-capable by either explicitly implementing the PersistenceCapable interface or using a JDO enhancer during or after compile time. (A JDO enhancer is a byte code enhancer program that modifies the byte codes of Java class files to enable transparent loading and storing of the persistent instances' fields.) You can make almost any user-defined class PersistenceCapable; however, some system classes, such as Thread, Socket, and File, among others, can never be persistence capable.

    Instances of a persistence-capable class can be either transient or persistent. Java defines two concepts for determining whether two instances are the same instance (identity) or whether they represent the same data (equality). Java object identity is entirely managed by the Instances are identical if and only if they occupy the same storage location within the Java Virtual Machine (JVM). JDO extends these concepts to determine if two instances represent the same data store object. Hence, a JDO identity differs from that of a Java object identity.

  • Close Icon
    Thanks for your registration, follow us on our social networks to keep up-to-date