Java and Object Databases

This example uses the ODMG Java Binding and the ODMG Object Query Language (OQL). Other query languages for object databases would be similar. Notice that all the code is Java, with the exception of the query string. You will not find a database sub-language in this example. The part in blue relates to the animation of . More information on the . Note that the same code would used for object-relational mapping products. Transparent persistent interfaces work with both object database or object-relational mapping products.

import org.odmg.*;
import java.util.Collection;
Implementation impl = new com.vendor.odmg.Implementation();
Database db = impl.newDatabase();
Transaction txn = impl.newTransaction();
try {"addressDB", Database.OPEN_READ_WRITE);
    // perform query
    OQLQuery query = new OQLQuery(
       "select x from Person x where = \"Doug Barry\"");
    Collection result = (Collection) query.execute();
    Iterator iter = result.iterator();
    // iterate over the results
    while ( iter.hasNext() )
        Person person = (Person);
        // do some addition processing on the person (not shown)
        // now traverse to the address object and update its value
        person.address.street = "13504 4th Avenue South";
//exception handling would go here ...

Context for Java and Object Databases

Related Articles for Java and Object Databases

The Savvy Manager's Guide

is also the author of a book that explains Web Services, service-oriented architecture, and Cloud Computing in an easy-to-understand, non-technical manner.

Web Services, Service-Oriented Architectures, and Cloud Computing: The Savvy Manager's Guide

by with David Dick

This is a guide for the savvy manager who wants to capitalize on the wave of change that is occurring with Web Services, service-oriented architecture, and—more recently—Cloud Computing. The changes wrought by these technologies will require both a basic grasp of the technologies and an effective way to deal with how these changes will affect the people who build and use the systems in our organizations. This book covers both issues. Managers at all levels of all organizations must be aware of both the changes that we are now seeing and ways to deal with issues created by those changes.