JDO and object databases

This example uses the Java Data Objects (JDO) Binding. Notice that all the code is Java. You will not find a database sub-language in this example. The part in blue relates to the animation of transparent persistence (new window). Note that the same code would used for object-relational mapping products (new window). Transparent persistent interfaces work with both object database or object-relational mapping products.

import javax.jdo.*;
import java.util.Collection;
PersistenceManagerFactory pmf; // assume this variable is set
pmf.setConnectionUserName("  ");
pmf.setConnectionPassword("  ");
pmf.setConnectionURL("database URL");
PersistenceManager pm = pmf.getPersistenceManager();
Transaction txn = pm.currentTransaction();
txn.begin();
Extent people = pm.getExtent(Person.class, false);
// perform query
Query query = pm.newQuery(Person.class, people, "name == \"Doug Barry\"");
Collection result = (Collection) query.execute();
    Iterator iter = result.iterator();
    // iterate over the results
    while ( iter.hasNext() )
    {
        Person person = (Person) iter.next();
        // 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";
    }
txn.commit();

 

 

Web Services and Service-Oriented Architectures
Online articles>
Consulting
Mentoring
Speaking
Suggested programs
Stencils for the Savvy Manager's Guide
Links
Mail list
Privacy policy
Sitemap
Contact
Web Services articles
XML standards and vocabularies
Application server articles
Database concepts and standards
Object database articles>
Relational database articles
Object-relational mapping articles
XML database articles
XML middleware articles
Article Sponsorship
Reprint policy
Object-oriented database management system (OODBMS) definition>
When an object database should be used
ODBMS FAQ
Caching for object database management systems
Architectures that use object database products
Everyday uses of object databases
ODBMS myths
Object database problems?
Article suggestions
Transparent persistence
Lack of impedance mismatch
How to access data in an object database>
Navigation with an object database
Java and object databases
JDO and object databases>
C++ and object databases

Related books at Amazon.com


Objects, Abstraction, Data Structures and Design: Using Java version 5.0
by Elliot B. Koffman, Paul A. T. Wolfgang
Average Customer Review: 4 stars based on 2 reviews.
Customer Review: Fails to address threading/concurrency issues. You will not find coverage of the new Concurrency Utilities including the new collection classes in package java.util.concurrent. You will not find the following terms in the index: concurrency synchronized thread thread-safe

Object-oriented Data Structures Using Java
by Nell B. Dale, Daniel T. Joyce, Chip Weems
Average Customer Review: 3.5 stars based on 3 reviews.
Customer Review: This seller was very punctual with the shipping and delivery of the book and it was in very good condition like the ad had stipulated. I will recomment him to anyone ST

Data Structures and Other Objects Using Java (3rd Edition)
by Michael Main
Average Customer Review: 3.5 stars based on 13 reviews.
Customer Review: I read a lot of confusing books by java experts that sometimes forget to go back to the simple basics when teaching simple minded readers. However, this book is for continuing readers of java who had some, but not expert training, experience in writing programs. What I liked most of this book is how he gives pointers on what to look...

Objects, Abstraction, Data Structures and Design: Using Java
by Elliot B. Koffman, Paul A. T. Wolfgang
Publisher: Wiley
Publication Date: August 2004

Data Structures and Software Development in an Object Oriented Domain, Java Edition
by Jean-Paul Tremblay, Grant A. Cheston
Publisher: Prentice Hall
Publication Date: August 2002

More related books: Search Amazon.com for JDO

 

Copyright © 2000-2008 Barry & Associates, Inc. All Rights Reserved.
You can use this material for your work or classes. Click here for our reprint policy.
www.service-architecture.com

 

 Information on becoming a sponsor

 

 

Google

 

Barry & Associates, Inc.