Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Go-ForIt quest continues, Part 6: Create persistent application data with Java Data Objects

Develop JDO applications using IBM WebSphere Studio Application Developer 5.0 and IBM DB2 Express 8.1

David Carew, Software architect, IBM
Author photo
David Carew is a Senior e-business Architect for IBM Developer Relations Technical Consulting in Austin, Texas, providing education, enablement, and consulting to IBM business partners. He joined IBM in 1988 and has held a variety of positions in development, from writing the code to control industrial robots to writing device drivers for AIX Wide Area Network devices. Somewhere along the way he learned Java, picked up an MBA from the University of Texas at Austin, and started consulting for Developer Relations. David is a Sun Certified Java Programmer, Certified Java Developer, Certified Architect for Java Technology and Certified Web Component Developer. You can contact him at carew@us.ibm.com.

Summary:  In this tutorial, you develop and test Java™ Data Objects (JDO)-based Web applications with IBM WebSphere® Studio Application Developer.

Date:  24 Jul 2003
Level:  Intermediate PDF:  A4 and Letter (295 KB | 24 pages)Get Adobe® Reader®

Activity:  3523 views
Comments:  

Introduction

About this tutorial

This tutorial assumes you have some familiarity with Web application development using Java and with interacting with relational databases using JDBC. Knowledge of DB2 or WebSphere Studio Application Developer (Application Developer) is helpful but is not required.

The code used in this tutorial uses Struts, an open source framework for Web application development. Knowledge of Struts is not required for this tutorial, but if you're curious about using Struts see the the tutorial Struttin' your stuff with WebSphere Studio.

The focus of this tutorial is developing Java Data Objects (JDO) that are persisted in DB2 using Application Developer and TJDO, an open source implementation of the JDO Specification. You are encouraged to read more on JDO, TJDO, DB2, and Application Developer as appropriate (see Resources for some suggested reading) after completing this tutorial.


Overview

The Go-ForIt application was developed by the Developer Relations Technical Consulting team using Extreme Programming. It is a Web site for the fictitious company Go-ForIt.com. Go-ForIt.com is a personal errand service. A customer registers at the site and posts errands they need done; for example, picking up laundry, walking the dog, standing in line at the license branch, and so on. Independent contractors, known as Personal Assistants (PAs) can also register at the site and bid on posted errands. Go-ForIt matches up the winning bid with the customer in need and collects a percentage of the fee paid for completion of the errand.

The most recent version of the Go-ForIt application was written using Struts, an open source Framework for Web application development, and utilized the Data Access Object pattern to allow us to experiment with different technologies for persisting application data with minimal impact on the application code. This tutorial is based on our experiences using JDO to persist application data.


JDO

The Java Data Objects API was developed under the Java Community Process as JSR 12. It defines a series on interfaces that application developers can use to persist the Java Objects that they use in their application.

JDO gives developers an object view of their persistent data, unlike JDBC where the developer is responsible for translating between the object representation of their data classes and the relational database tables used to persist them.

Implementation of the interfaces in the JDO API is the responsibility of JDO Providers. The runtime classes that these Providers make available to developers allow developers to persist their data classes without explicit knowledge of the structure of the underlying database tables used. JDO Providers also handle issues like caching and data concurrency, leaving you free to focus on the business logic of your applications. Several JDO Providers are available to choose from (see the JDOCentral link under Resources). In this tutorial I'll use TJDO, an open source JDO implementation that supports DB2 and several other relational databases.


TriActive JDO (TJDO)

TriActive JDO, or TJDO, is an open source implementation of the JDO Specification (Version 1.0). The highlights of this implementation, as described at the TJDO Web site, are that it:

  • Implements the entire JDOQL query language, including several useful method enhancements.
  • Auto-creates all necessary schema elements (tables, foreign keys, indexes) according to your app's classes and JDO metadata.
  • Auto-validates expected schema structure at runtime, reducing failures from schema evolution.
  • Can map Java classes to SQL views, and allows for direct SQL queries, to leverage SQL capabilities not normally accessible through JDO.
  • Is designed to be lightweight and fast.

As of the time of this writing the available version is 2.0 Beta 3.


WebSphere Studio Application Developer

IBM WebSphere Studio Application Developer (Application Developer) is IBM's integrated development environment (IDE) for J2EE developers and Java programmers. It is based on WebSphere Studio Workbench, IBM's open tool integration platform. WebSphere Studio Workbench is built on the open-source Eclipse Platform. Eclipse.org is a consortium of development tool providers that are working to provide a common platform for seamless integration of tools from different vendors.

Application Developer's user interface is based on perspectives. A perspective is a group of related views and editors. Application Developer contains several perspectives geared towards role-based development. Different roles use different perspectives; for example, a Web developer might use the Web perspective, while an EJB developer might use the J2EE perspective.


DB2 Universal Database Express Edition V8.1

DB2 Universal Database Express Edition V8.1 (DB2 Express) is the newest member of the DB2 Universal Database product family. DB2 Express is a specially tailored full-featured relational database for small and medium business.

DB2 Express includes:

  • JDBC, MDAC 2.7, ODBC, OLE BD, SQLJ support
  • Satellite synchronization
  • Spatial and XML Extender
  • Support for the following communication protocols: APPC, NetBIOS, TCP/IP, Named Pipes

You can run DB2 Express on Windows NT/2000/2003/XP or on Linux.


Required software

The following software is required for this tutorial:

  • WebSphere Studio Application Developer Version 5.0. You can download a trial version here.
  • DB2 Universal Database Express Edition V8.1. You can download a trial version here.
  • jdotutorial.zip: Download a small slice of the Go-ForIt application to use as a starting point for the tutorial. This contains a set of JSP pages and Struts components. I've also included the library files from the Struts 1.1 RC1 distribution, the TJDO Version 2.0 Beta 3 runtime files, the Apache Xerces XML parser and the Log4J runtime files (the latter two are both required by TJDO).

1 of 12 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere, Information Management, Java technology
ArticleID=130089
TutorialTitle=Go-ForIt quest continues, Part 6: Create persistent application data with Java Data Objects
publish-date=07242003
author1-email=
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.