Newsletter sign-up
View all newsletters

Sign up for our Enterprise Java Newsletter

Enterprise Java

Persist data with Java Data Objects, Part 1

Grasp the qualities behind an ideal persistence layer

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
"Everything should be made as simple as possible, but not simpler."

Albert Einstein



The need to persist data created at runtime is as old as computing. And the need to store object-oriented data cropped up when object-oriented programming became pervasive. Currently, most modern, nontrivial applications use an object-oriented paradigm to model application domains. In contrast, the database market is more divided. Most database systems use the relational model, but object-based data stores prove indispensable in many applications. Plus, we also have legacy systems that we often need to interface to.

This article identifies the issues associated with data persistence in transactional middleware environments, such as J2EE (Java 2 Platform, Enterprise Edition), and shows how Java Data Objects (JDO) solves some of those issues. This article provides an overview, not a detailed tutorial, and is written from the viewpoint of an application developer, not a JDO implementation designer.

Read the whole series on Java Data Objects:



Those Java developers, designers, and J2EE architects who work on systems that must store data in relational or object databases, or other storage media should read this article. I assume you have a basic knowledge of Java and some familiarity with object-relational issues and terminology.

Transparent persistence: Why bother?

More than a decade of continuous attempts to bridge object-oriented runtime and persistence point to several important observations (listed in order of importance):

  1. Abstracting away any persistence details and having a clean, simple, object-oriented API to perform data storage is paramount. We don't want to handle persistence details and internal data representation in data stores, be they relational, object-based, or something else. Why should we deal with low-level constructs of the data-store model, such as rows and columns, and constantly translate them back and forth? Instead, we need to concentrate on that complex application we were required to deliver by yesterday.
  2. We want to use the plug-and-play approach with our data stores: We want to use different providers/implementations without changing a line of the application source code -- and perhaps without modifying more than a few lines in the appropriate configuration file(s). In other words, we need an industry standard for accessing data based on Java objects, one that plays a role similar to the one JDBC (Java Database Connectivity) plays as an industry standard for accessing SQL-based data.
  3. We want to use the plug-and-play approach with different database paradigms -- that is, we want to switch from a relational database to an object-oriented one with minimal changes to the application code. Though nice to have, in practice, this capability is often not required.

    One comment here: While relational databases enjoy the biggest market presence by far, providing a unified persistence API and allowing data-store providers to compete on implementation strengths makes sense, regardless of the paradigm these providers use. This approach might eventually help level the playing field between the two dominant database vendor groups: the well-entrenched relational camp and the struggling-for-market-share object-oriented camp.

    • Digg
    • Reddit
    • SlashDot
    • Stumble
    • del.icio.us
    • Technorati
    • dzone
    Comments (2)
    Login
    Forgot your account info?

    Thank youBy Anonymous on October 5, 2009, 5:58 pmnice:) thank you for your time.

    Reply | Read entire comment

    Hello, Just read your post and wanted to say thank you! Nice list you've made:) Best regards, Jennifer Armia Internet MarketinBy Anonymous on July 13, 2009, 6:32 amHello, Just read your post and wanted to say thank you! Nice list you've made:) Best regards, Jennifer Armia Internet Marketing Officer Free social media and internet...

    Reply | Read entire comment

    View all comments

    Add comment
    Anonymous comments subject to approval. Register here for member benefits.
    Have a JavaWorld account? Log in here. Register now for a free account.
    Resources