Java Data Objects revolutionizes the way Java developers interact with databases and other datastores. JDO allows you to store and retrieve objects in a way that's natural to Java programmers. Instead of working with JDBC or EJB's container-managed persistence, you work directly with your Java objects. You don't have to copy data to and from database tables or issue SELECTs to perform queries: your JDO implementation takes care of persistence behind-the-scenes, and you make queries based on the fields of your Java objects, using normal Java syntax.
The result is software that is truly object-oriented: not code that is partially object-oriented, with a large database-shaped lump on the back end. JDO lets you save plain, ordinary Java objects, and does not force you to use different data models and types for dealing with storage. As a result, your code becomes easier to maintain, easier to re-use, and easier to test. And you're not tied to a specific database vendor: your JDO code is entirely database-independent. You don't even need to know whether the datastore is a relational database, an object database, or just a set of files.
This book, written by the JDO Specification Lead and one of the key contributors to the JDO Specification, is the definitive work on the JDO API. It gives you a thorough introduction to JDO, starting with a simple application that demonstrates many of JDO's capabilities. It shows you how to make classes persistent, how JDO maps persistent classes to the database, how to configure JDO at runtime, how to perform transactions, and how to make queries. More advanced chapters cover optional features such as nontransactional access and optimistic transactions. The book concludes by discussing the use of JDO in web applications and J2EE environments.
Whether you only want to read up on an interesting new technology, or are seriously considering an alternative to JDBC or EJB CMP, you'll find that this book is essential. It provides by far the most authoritative and complete coverage available.
David Jordan founded Object Identity, Inc. in 2001 to provide JDO consulting services. He became interested in the integration of object type systems and databases while earning his M.S. in Computer Science in the early 1980s. At Bell Labs in 1985, he initiated the development of the first C++ object database. He has developed a variety of applications using C++ object models on top of network, relational, and object database systems. Bell Labs appointed him a Distinguished Member of Technical Staff in 1990 for his contributions in object and database technologies. The Object Data Management Group (ODMG) asked him to serve as their C++ editor in 1993. He served in that role until 2000 and was appointed their Java editor in 1998. He coedited four books published by the ODMG. David served as a C++ Report columnist describing the ODMG standard from 1994 to 1996, at which point he stopped to write his first book, C++ Object Databases. David started using Java in late 1995. Upon his selection as ODMG's Java editor, he became a columnist for Java Report, initially covering ODMG and then JDO. David was part of the small group that initiated JSR-12, and he became one of the initial members of the JDO expert group. The JDO specification has a special acknowledgment of David's contributions to the JDO standard. When the JDOcentral.com community web site was formed, David was selected to serve as its moderator. David can be reached at david.jordan@objectidentity.com
Dedication; Foreword; Preface; Who Should Read This Book?; Organization; Software and Versions; Using Code Examples; Conventions; Comments and Questions; Acknowledgments; Chapter 1: An Initial Tour; 1.1 Defining a Persistent Object Model; 1.2 Project Build Environment; 1.3 Establish a Datastore Connection and Transaction; 1.4 Operations on Instances; 1.5 Summary; Chapter 2: An Overview of JDO Interfaces; 2.1 The javax.jdo Package; 2.2 The javax.jdo.spi Package; 2.3 Optional Features; Chapter 3: JDO Architectures; 3.1 Architecture Within Application JVM; 3.2 Datastore Access; 3.3 System Architectures with a JDO Application; Chapter 4: Defining Persistent Classes; 4.1 Kinds of Classes and Instances; 4.2 Java Classes and Metadata; 4.3 Fields; Chapter 5: Datastore Mappings; 5.1 Mapping Approaches; 5.2 Relational Modeling Constructs; 5.3 Modeling Constructs in Java and Relational Models; 5.4 Mapping Classes to Tables; 5.5 Mapping a Single-Valued Field to a Column; 5.6 Identity; 5.7 Inheritance; 5.8 References; 5.9 Collections and Relationships; Chapter 6: Class Enhancement; 6.1 Enhancement Approaches; 6.2 Binary Compatibility; 6.3 Enhancement Effects on Your Code; 6.4 Changes Made by the Enhancer; Chapter 7: Establishing a JDO Runtime Environment; 7.1 Configuring a PersistenceManagerFactory; 7.2 Acquiring a PersistenceManager; 7.3 Transactions; 7.4 Multiple PersistenceManagers; 7.5 Multithreading; Chapter 8: Instance Management; 8.1 Persistence of Instances; 8.2 Extent Access; 8.3 Accessing and Updating Instances; 8.4 Deleting Instances; Chapter 9: The JDO Query Language; 9.1 Query Components; 9.2 Creating and Initializing a Query; 9.3 Changes in the Cache; 9.4 Query Namespaces; 9.5 Query Execution; 9.6 The Query Filter; 9.7 Ordering Query Results; 9.8 Closing a Query; Chapter 10: Identity; 10.1 Overview; 10.2 Datastore Identity; 10.3 Application Identity; 10.4 Nondurable Identity; 10.5 Identity Methods; 10.6 Advanced Topics; Chapter 11: Lifecycle States and Transitions; 11.1 Lifecycle States; 11.2 State Interrogation; 11.3 State Transitions; Chapter 12: Field Management; 12.1 Transactional Fields; 12.2 null Values; 12.3 Retrieval of Fields; 12.4 Serialization; 12.5 Managing Fields During Lifecycle Events; 12.6 First- and Second-Class Objects; Chapter 13: Cache Management; 13.1 Explicit Management of Instances in the Cache; 13.2 Cloning; 13.3 Transient-Transactional Instances; 13.4 Making a Persistent Instance Transient; Chapter 14: Nontransactional Access; 14.1 Nontransactional Features; 14.2 Reading Outside a Transaction; 14.3 Persistent-Nontransactional State; 14.4 Retaining Values at Transaction Commit; 14.5 Restoring Values at Transaction Rollback; 14.6 Modifying Persistent Instances Outside a Transaction; Chapter 15: Optimistic Transactions; 15.1 Verification at Commit; 15.2 Optimistic Transaction State Transitions; 15.3 Deleting Instances; 15.4 Making Instances Transactional; 15.5 Modifying Instances; 15.6 Commit; 15.7 Rollback; Chapter 16: The Web-Server Environment; 16.1 Web Servers; 16.2 Struts with JDO; Chapter 17: J2EE Application Servers; 17.1 Enterprise JavaBeans Architecture; 17.2 Stateless Session Beans; 17.3 Bean-Managed Transactions; 17.4 Message-Driven Beans; 17.5 Persistent Entities and JDO; Lifecycle States and Transitions; JDO Metadata DTD; JDO Interfaces and Exception Classes; Interfaces; Exceptions; JDO Query Language BNF; Parameter Declaration; Variable Declaration; Import Declaration; Ordering Specification; Type Specification; Names; Literal; Filter Expressions; Source Code for Examples; The com.mediamania.appserver package; The com.mediamania.content package; The com.mediamania.hotcache package; The com.mediamania.store package; Colophon;
Show moreJava Data Objects revolutionizes the way Java developers interact with databases and other datastores. JDO allows you to store and retrieve objects in a way that's natural to Java programmers. Instead of working with JDBC or EJB's container-managed persistence, you work directly with your Java objects. You don't have to copy data to and from database tables or issue SELECTs to perform queries: your JDO implementation takes care of persistence behind-the-scenes, and you make queries based on the fields of your Java objects, using normal Java syntax.
The result is software that is truly object-oriented: not code that is partially object-oriented, with a large database-shaped lump on the back end. JDO lets you save plain, ordinary Java objects, and does not force you to use different data models and types for dealing with storage. As a result, your code becomes easier to maintain, easier to re-use, and easier to test. And you're not tied to a specific database vendor: your JDO code is entirely database-independent. You don't even need to know whether the datastore is a relational database, an object database, or just a set of files.
This book, written by the JDO Specification Lead and one of the key contributors to the JDO Specification, is the definitive work on the JDO API. It gives you a thorough introduction to JDO, starting with a simple application that demonstrates many of JDO's capabilities. It shows you how to make classes persistent, how JDO maps persistent classes to the database, how to configure JDO at runtime, how to perform transactions, and how to make queries. More advanced chapters cover optional features such as nontransactional access and optimistic transactions. The book concludes by discussing the use of JDO in web applications and J2EE environments.
Whether you only want to read up on an interesting new technology, or are seriously considering an alternative to JDBC or EJB CMP, you'll find that this book is essential. It provides by far the most authoritative and complete coverage available.
David Jordan founded Object Identity, Inc. in 2001 to provide JDO consulting services. He became interested in the integration of object type systems and databases while earning his M.S. in Computer Science in the early 1980s. At Bell Labs in 1985, he initiated the development of the first C++ object database. He has developed a variety of applications using C++ object models on top of network, relational, and object database systems. Bell Labs appointed him a Distinguished Member of Technical Staff in 1990 for his contributions in object and database technologies. The Object Data Management Group (ODMG) asked him to serve as their C++ editor in 1993. He served in that role until 2000 and was appointed their Java editor in 1998. He coedited four books published by the ODMG. David served as a C++ Report columnist describing the ODMG standard from 1994 to 1996, at which point he stopped to write his first book, C++ Object Databases. David started using Java in late 1995. Upon his selection as ODMG's Java editor, he became a columnist for Java Report, initially covering ODMG and then JDO. David was part of the small group that initiated JSR-12, and he became one of the initial members of the JDO expert group. The JDO specification has a special acknowledgment of David's contributions to the JDO standard. When the JDOcentral.com community web site was formed, David was selected to serve as its moderator. David can be reached at david.jordan@objectidentity.com
Dedication; Foreword; Preface; Who Should Read This Book?; Organization; Software and Versions; Using Code Examples; Conventions; Comments and Questions; Acknowledgments; Chapter 1: An Initial Tour; 1.1 Defining a Persistent Object Model; 1.2 Project Build Environment; 1.3 Establish a Datastore Connection and Transaction; 1.4 Operations on Instances; 1.5 Summary; Chapter 2: An Overview of JDO Interfaces; 2.1 The javax.jdo Package; 2.2 The javax.jdo.spi Package; 2.3 Optional Features; Chapter 3: JDO Architectures; 3.1 Architecture Within Application JVM; 3.2 Datastore Access; 3.3 System Architectures with a JDO Application; Chapter 4: Defining Persistent Classes; 4.1 Kinds of Classes and Instances; 4.2 Java Classes and Metadata; 4.3 Fields; Chapter 5: Datastore Mappings; 5.1 Mapping Approaches; 5.2 Relational Modeling Constructs; 5.3 Modeling Constructs in Java and Relational Models; 5.4 Mapping Classes to Tables; 5.5 Mapping a Single-Valued Field to a Column; 5.6 Identity; 5.7 Inheritance; 5.8 References; 5.9 Collections and Relationships; Chapter 6: Class Enhancement; 6.1 Enhancement Approaches; 6.2 Binary Compatibility; 6.3 Enhancement Effects on Your Code; 6.4 Changes Made by the Enhancer; Chapter 7: Establishing a JDO Runtime Environment; 7.1 Configuring a PersistenceManagerFactory; 7.2 Acquiring a PersistenceManager; 7.3 Transactions; 7.4 Multiple PersistenceManagers; 7.5 Multithreading; Chapter 8: Instance Management; 8.1 Persistence of Instances; 8.2 Extent Access; 8.3 Accessing and Updating Instances; 8.4 Deleting Instances; Chapter 9: The JDO Query Language; 9.1 Query Components; 9.2 Creating and Initializing a Query; 9.3 Changes in the Cache; 9.4 Query Namespaces; 9.5 Query Execution; 9.6 The Query Filter; 9.7 Ordering Query Results; 9.8 Closing a Query; Chapter 10: Identity; 10.1 Overview; 10.2 Datastore Identity; 10.3 Application Identity; 10.4 Nondurable Identity; 10.5 Identity Methods; 10.6 Advanced Topics; Chapter 11: Lifecycle States and Transitions; 11.1 Lifecycle States; 11.2 State Interrogation; 11.3 State Transitions; Chapter 12: Field Management; 12.1 Transactional Fields; 12.2 null Values; 12.3 Retrieval of Fields; 12.4 Serialization; 12.5 Managing Fields During Lifecycle Events; 12.6 First- and Second-Class Objects; Chapter 13: Cache Management; 13.1 Explicit Management of Instances in the Cache; 13.2 Cloning; 13.3 Transient-Transactional Instances; 13.4 Making a Persistent Instance Transient; Chapter 14: Nontransactional Access; 14.1 Nontransactional Features; 14.2 Reading Outside a Transaction; 14.3 Persistent-Nontransactional State; 14.4 Retaining Values at Transaction Commit; 14.5 Restoring Values at Transaction Rollback; 14.6 Modifying Persistent Instances Outside a Transaction; Chapter 15: Optimistic Transactions; 15.1 Verification at Commit; 15.2 Optimistic Transaction State Transitions; 15.3 Deleting Instances; 15.4 Making Instances Transactional; 15.5 Modifying Instances; 15.6 Commit; 15.7 Rollback; Chapter 16: The Web-Server Environment; 16.1 Web Servers; 16.2 Struts with JDO; Chapter 17: J2EE Application Servers; 17.1 Enterprise JavaBeans Architecture; 17.2 Stateless Session Beans; 17.3 Bean-Managed Transactions; 17.4 Message-Driven Beans; 17.5 Persistent Entities and JDO; Lifecycle States and Transitions; JDO Metadata DTD; JDO Interfaces and Exception Classes; Interfaces; Exceptions; JDO Query Language BNF; Parameter Declaration; Variable Declaration; Import Declaration; Ordering Specification; Type Specification; Names; Literal; Filter Expressions; Source Code for Examples; The com.mediamania.appserver package; The com.mediamania.content package; The com.mediamania.hotcache package; The com.mediamania.store package; Colophon;
Show moreForeword Preface 1. An Initial Tour Defining a Persistent Object Model The Classes to Persist Declaring Classes to Be Persistent Project Build Environment Jars Needed to Use the JDO Reference Implementation Project Directory Structure Enhancing Classes for Persistence Establish a Datastore Connection and Transaction Acquiring a PersistenceManager Creating a FOStore Datastore Operations on Instances Making Instances Persistent Accessing Instances Modifying an Instance Deleting Instances Summary 2. An Overview of JDO Interfaces The javax.jdo Package JDO Exception Classes The javax.jdo.spi Package Optional Features Identity Options Optional Collections Transaction-Related Optional Features 3. JDO Architectures Architecture Within Application JVM Single PersistenceManager Multiple PersistenceManagers Accessing the Same Datastore Multiple PersistenceManagers Accessing Different Datastores Shared Implementation Cache Datastore Access Direct Access of Filesystem or Local Datastore Remote Access of a JDO Server Remote Access of a SQL Datastore System Architectures with a JDO Application JDO Rich Client with Local Datastore JDO Applications in a Web Server JDO Applications as Web Services Rich Client Connecting to Application Server with EJB Components Web Server with EJB Server EJB Session Beans Using Session Bean Facades JDO Providing Container-Managed Persistence 4. Defining Persistent Classes Kinds of Classes and Instances Kinds of Classes Kinds of Instances Java Classes and Metadata JDO Metadata Inheritance The Media Mania Object Model Fields Supported Types Persistence of Fields Complete Metadata for the Media Mania Model 5. Datastore Mappings Mapping Approaches Relational Modeling Constructs SQL 99 Modeling Constructs in Java and Relational Models Mapping Classes to Tables Mapping a Single-Valued Field to a Column Name-Mapping Type-Mapping Indexes Identity Inheritance References Collections and Relationships Using a Foreign Key Using a Join Table One-to-One Relationships Representing Lists and Maps 6. Class Enhancement Enhancement Approaches Reference Enhancer Vendor-Specific Enhancement Binary Compatibility Enhancement Effects on Your Code Changes Made by the Enhancer Metadata Instance-Level Data Field Mediation 7. Establishing a JDO Runtime Environment Configuring a PersistenceManagerFactory Connection Properties Optional Feature Properties Flags Flags Settings in Multiple Interfaces Determining the Optional Features and Default Flag Settings Vendor-Specific Properties Nonconfigurable Properties Acquiring a PersistenceManager User Object Closing a PersistenceManager Closing a PersistenceManagerFactory Transactions Properties of Transactions Transactions and Locking in the Datastore Types of Transactions in JDO Acquiring a Transaction Setting the Transaction Type Transaction Demarcation Restoring Values on Rollback Determining Whether a Transaction Is Active Multiple PersistenceManagers Multithreading 8. Instance Management Persistence of Instances Explicit Persistence Persistence-by-Reachability Extent Access Accessing an Extent Extent Iteration Ignoring the Cache Accessing and Updating Instances Explicit Marking of Modified Instances Deleting Instances Delete Propagation 9. The JDO Query Language Query Components Creating and Initializing a Query Changes in the Cache Query Namespaces Type Names Field, Parameter, and Variable Names Keywords Literals Query Execution Parameter Declarations Executing a Query Compiling a Query The Query Filter General Characteristics of Expressions Query Operators References Collections Ordering Query Results Closing a Query 10. Identity Overview JDO Identity Types Metadata Identity Class Datastore Identity Application Identity Primary-Key Fields Persistent Class equals() and hashCode( ) Methods The Application-Identity Class A Single-Field Primary Key A Compound Primary Key A Compound Primary Key That Contains a Foreign Key Application Identity in an Inheritance Hierarchy Nondurable Identity Identity Methods Get the Identity Class Get the Identity of an Instance Getting an Instance via Its Identity Changing the Application Identity of an Instanc Get the Current Application Identity of an Instance The String Representation of Identity Advanced Topics Choosing an Identity Type Using Identity Versus a Query Identity Across PersistenceManagers 11. Lifecycle States and Transitions Lifecycle States Transient Persistent-New Hollow Persistent-Clean Persistent-Dirty Persistent-Deleted Persistent-New-Deleted State Interrogation State Transitions State Transitions During a Datastore Transaction State Transitions When a Transaction Completes States Between Transactions 12. Field Management Transactional Fields null Values Retrieval of Fields Default Fetch Group Retrieving All Fields The Management of Fields Serialization Managing Fields During Lifecycle Events First- and Second-Class Objects Specifying a Second-Class Object Embedding Collection Elements Persistent Classes as Second-Class Objects Sharing of Instances 13. Cache Management Explicit Management of Instances in the Cache Refreshing Instances Evicting Instances Cloning Transient-Transactional Instances Transient-Transactional Lifecycle States State Interrogation State Transitions Making a Persistent Instance Transient 14. Nontransactional Access Nontransactional Features Reading Outside a Transaction Persistent-Nontransactional State Retaining Values at Transaction Commit Restoring Values at Transaction Rollback Before Image Restoring Persistent Instances Restoring Persistent-New Instances Modifying Persistent Instances Outside a Transaction Hot Cache Example 15. Optimistic Transactions Verification at Commit Recovery from a Failed Transaction Setting Optimistic Transaction Behavior Optimistic Example Optimistic Transaction State Transitions Deleting Instances Making Instances Transactional Modifying Instances Commit Rollback 16. The Web-Server Environment Web Servers Accessing the PersistenceManagerFactory Servicing Requests PersistenceManager per Request PersistenceManager per Application PersistenceManager per Transactional Request PersistenceManager per Session Transactions JavaServer Pages Struts with JDO 17. J2EE Application Servers Enterprise JavaBeans Architecture Stateless Session Beans Configuring the PersistenceManagerFactory Stateless Session Beans with Container-Managed Transactions Stateful Session Beans with Container-Managed Transactions Bean-Managed Transactions javax.transaction.UserTransaction javax.jdo.Transaction Stateless Session Beans with Bean-Managed Transactions Stateful Session Beans with Bean-Managed Transactions Message-Driven Beans Persistent Entities and JDO Local Persistent Storage Remote Persistent Storage A. Lifecycle States and Transitions B. JDO Metadata DTD C. JDO Interfaces and Exception Classes D. JDO Query Language BNF E. Source Code for Examples Index
David Jordan has been involved in transparent persistence technologies since 1985. He instigated the development of the first C++ object database while at Bell Labs and has been a member of the JDO expert group since its inception. He is recognized in the JDO specification for his contributions to the technology. Craig Russell is the specification lead for JDO at Sun Microsystems. He is also responsible for overall development of JDO Reference Implementation. Prior to Sun he was an architect at Versant, an object database company supporting transparent persistence.
![]() |
Ask a Question About this Product More... |
![]() |