Core Java Data Objects (Sun Microsystems Press Java Series)

Core Java Data Objects (Sun Microsystems Press Java Series)

Paperback

$42.08 $49.99 Save 16% Current price is $42.08, Original price is $49.99. You Save 16%.

Product Details

ISBN-13: 9780131407312
Publisher: Prentice Hall
Publication date: 08/15/2003
Series: Sun Microsystems Press Java Series
Pages: 491
Product dimensions: 7.00(w) x 9.30(h) x 0.80(d)

About the Author

SAMEER TYAGI is Enterprise Java Architect at Sun Microsystems' Java Center in Burlington, MA. He co-authored Professional JSP, Professional JSP-J2EE Edition, and Professional Java Server Programming-J2EE Edition, and writes regularly for Java Pro, JavaWorld, and Java Developers Journal.

MICHAEL VORBURGER is Chief Software Architect for Vertical*I, a firm providing enterprise software solutions to the life sciences industries. He has implemented large-scale persistence systems inspired by the JDO standard.

KEIRON MCCAMMON, CTO, Versant Corporation, responsible for product strategy and direction, has worked with finance and telecom customers to develop and deploy large scale Java/J2EE distributed object solutions. A member of the JDO expert group, he presents regularly on JDO at leading events.

HEIKO BOBZIN, also a member of the JDO expert group, led JDO and ODMG 3.0 implementation at Poet Software.

Table of Contents

Foreword.

Preface.

Acknowledgments.

I. INTRODUCTION.

1. JDO Overview.

JDO Background. Domain Object Model. Orthogonal Persistence. Non-Managed and Managed Environments. Roles and Responsibilities. Summary.

2. Object Persistence Fundamentals.

Persistence in Applications. JDK Binary Serialization. Object-Relational Mapping. Rolling Your Own Persistence Mapping Layer. Conclusion.

II. THE DETAILS.

3. Getting Started with JDO.

How Does JDO Work? The JDO Basics. Defining a Class. Connecting to a Datastore. Creating an Object. Reading an Object. Updating an Object. Deleting an Object. JDO Object Model. Exception Handling. Object Identity. Types of Object Identity. Object Lifecycles. Concurrency Control. Summary.

4. Object Lifecycle.

A Persistent Object's Lifecycle. Finding Out about an Object's State. Operations That Change State. Callbacks. Optional States. Putting It All Together. Summary.

5. Developing with JDO.

JDO Concepts. JDO Interfaces and Classes. Basic APIs. Exception Classes. Additional APIs. Service Provider Interface APIs. Summary.

6. Finding Your Data.

Finding an Object by Identity. Finding a Set of Objects Using an Extent. Finding Objects with the Query Facility. JDOQL. Queries, Filters, and Optional parameters. More on the Query Interface. Summary.

7. Architecture Scenarios.

JDO versus JDBC. RDBMS, ODBMS, and Flatfiles. J2EE, RMI, and CORBA. Managed and Non-Managed Environments. Multi-Threaded Applications. Summary.

III. J2EE.

8. JDO and the J2EE Connector Architecture.

J2EE Connector Architecture Overview. JDO and the J2EE Connector Architecture. Using JDO and the J2EE Connector Architecture. Using JDO without the J2EE Connector Architecture. Summary.

9. JDO and Enterprise JavaBeans.

Introduction. Session Beans and JDO. Message-Driven Beans and JDO. Entity Beans and JDO. To Use EJB or Not to Use EJB? Summary.

10. Security.

Security Levels. Implementing PersistenceCapable. Application Security. Summary.

11. Transactions.

Transaction Concepts. Transactions in Java. Transactions in JDO. Summary.

IV. THE CONCLUSION.

12. JDO and JDBC.

JDBC 2.0 and 3.0. Example: Storing Objects in a Relational Database Using JDBC. Comparison of JDBC and JDO. Summary.

13. Tips, Tricks and Best Practices.

Data Modeling. JDO and Servlets. Keep Domain Classes Separate from Others. Using XML as a Data Exchange Format. Validation. Summary.

14. The Road Ahead.

Advanced Transaction Semantics. Performance Optimizations. Managed Relationships. Query Enhancements. Object Mapping. Enumeration Pattern. Summary.

15. Case Study: The Core JDO Library.

Files, Packages and Object Model. Persistent Model Package. Use-case Package. BookOperation Class. Putting Things Together.

Appendix A: JDO States.

Appendix B: XML Metadata.

Appendix C: JDOQL BNF Notation.

Appendix D: PersistenceManager Factory Quick Reference.

Appendix E: JDO Implementations.

Index.

Preface

Preface

The need for persistence is a prerequisite for any enterprise application, and the case is no different for applications written in the Java programming language. A chunk of any typical Java application consists of code that is responsible for storing and retrieving the application-specific data to some type of storage facility so that it can be retrieved and used at a later time. Java is an object-oriented language, and developers inherently work with objects that, at any time, have states represented by member fields. From the developers perspective, persistence focuses on taking the application-specific information assets, which in fact is just state in these objects, and making them available beyond the lifetime of the virtual machine process. In short, data should be available once the Java virtual machine has exited.

The realization of this notion by developers can take many shapes: extracting and storing the state in a file or in a database using JDBC, using Java serialization and storing the binary representation of the entire object, or the more common enterprise approach of leveraging the facilities of an application server via EJBs to name a few. Irrespective of the technique and the varying degree of complexity involved, each of these approaches has one common conceptual characteristic: the dependence on the developer to extract state information from the objects when it needs to be saved and re-create that state in the object representation when needed by the application.

Now there is a new alternative--Java Data Objects (JDO)--that is well placed to change the way developers have traditionally perceived persistence in their applications. JDO is a standard developed under the auspices of the Java Community Process by a number of industry participants. The JDO specifications were the realization of an effort to satisfy the need for a transparent persistence mechanism in Java that would satisfy two orthogonal visions at the same time. One aimed to provide a standard programming interface between application code and the underlying persistent stores like databases and file systems in a manner similar to JDBC; the other aimed to simplify secure and scalable application development by providing a Java-centric mechanism that would allow the manipulation and traversal of persistent objects. JDO satisfies, in fact excels, at both. With JDO, developers can concentrate on designing applications around the intended purpose--to solve business problems--rather than around the mechanics of persistence infrastructures.

JDO is fast gaining momentum and acceptance in the community as the preferable means to introduce persistence in Java applications. Developers are learning to appreciate the simplicity and power of this technology, and architects are pleased at the reduced development time. In this book, we not only guide the reader in understanding JDO itself, but help readers learn how to apply this technology effectively in real-world applications.

Audience

JDO is a new technology, but it is one that holds great promise. If you are an architect, a developer, or even a manager who is involved with persistence in Java and would like to gain an insight into this technology, then this book is for you.

The driving goal of this author team is to combine their wealth of experience into a single accessible and unified resource and give the community a definitive and authoritative source to turn to for JDO technology. The team strives to provide leading edge and practical examples that illustrate how JDO can be applied to existing applications and new architecture initiatives so that readers can have a clear perspective of this new technology. We hope that professionals using Java in any measure, from simple programs to complex enterprise applications, find this book valuable. Where additional detail is required, this book provides the stepping-stone and points out additional sources of information.

In keeping with the vision of Java itself, this book attempts to stay vendor- and platform-neutral. Possible implementation strategies may be discussed occasionally, but the goal of the author team is not to discuss intricate details, recommend, or push any specific vendor product.

What This Book Is About

This book is about:Everything JDO, in that the book provides an in-depth explanation about the technology Applying JDO in applications ranging from standalone programs to J2EE components The best practices in designing and developing applications that use JDO

Part One--Introduction

Chapter 1: JDO Overview

Java Data Objects is a new standard for persistence in Java applications. JDO is well placed to change the fundamental way in which architects and developers approach the design and development of persistence in Java applications. This chapter gives you an insight into the concepts around which JDO is centered.

Chapter 2: Object Persistence Fundamentals

Chapter 2 looks at what's technically behind object persistence. It explains and compares different ways to implement persistence frameworks. It takes a broad view of the JDBC-based object-relational mapping solutions and outlines the effort of implementing such a framework from scratch.

Part Two--The Details

Chapter 3: Getting Started with JDO

This chapter explains the basics of how JDO works and how to use JDO to create, read, update, and delete persistent objects. It introduces some of the advanced concepts behind JDO and aims to provide sufficient understanding to allow a Java programmer to develop an application using JDO.

Chapter 4: Lifecycles

This chapter discusses the lifecycle of objects and the reasons why state changes can be meaningful to the application developer. A closer look is taken at mandatory and optional states of instances, the methods to gather information about states, and methods that lead to state transitions.

Chapter 5: Developing with JDO

This chapter looks at fundamental JDO concepts and all the classes and APIs defined by the JDO specification. It explains each of the methods for interfaces like the PersistenceManager, the JDOHelper, and I18NHelper classes, overviews JDO exception classes, and the classes and interfaces in the service provider interface package.

Chapter 6: Finding Your Data

This chapter discusses the query facility provided by JDO specification. The techniques surrounding the retrieval and querying of the underlying datatstore using the API and the JDOQL (JDO Query Language) are discussed with detailed examples.

Chapter 7: Architecture Scenarios

This chapter outlines the different types of application architectures that can be used with JDO. It covers when to use JDO versus JDBC, different types of datastores that can be used with JDO, using JDO with multi-tier applications, and using multi-threaded programming with JDO.

Part Three--J2EE

Chapter 8: JDO and the J2EE Connector Architecture

This chapter explains how JDO can be used in conjunction with J2EE via the J2EE Connector Architecture (JCA). After a brief introduction to JCA, this chapter looks at how JCA fits together with JDO and how they can be used together to build J2EE applications.

Chapter 9: JDO and Enterprise JavaBeans (EJB)

This chapter looks at the Enterprise JavaBeans (EJB) component model and its relationship to JDO. It addresses various implementation topics and provides extensive source code examples. The goal of this chapter is not to simply show 'how' to code EJB and JDO together, but also to help you decide if the combination of these two APIs makes sense for you.

Chapter 10: Security

This chapter defines the different levels of security, their requirements, and their objectives. It looks at the Reference Enhancer, and examines the rules and measures defined by JDO to secure an application. Finally, the chapter looks at application-level security and how J2EE and JDO work together regarding security.

Chapter 11: Transactions

This chapter looks at some fundamental concepts around transactions in Java, the transaction capabilities included in JDO, and how they can be used in standalone applications and in conjunction with Java Transaction APIs (JTA) in managed environments. It also outlines design considerations and practices when using JDO in a transactional manner.

Part Four--The Conclusion

Chapter 12--JDO and Java Database Connectivity (JDBC)

This chapter reviews the JDBC API, gives a brief overview of relational databases, looks at the history of JDBC, and provides an introduction to the new JDBC 3.0 API. The second part of the chapter compares JDBC with JDO, discusses features and differences of each, and highlights common misconceptions.

Chapter 13: Best Practices

This chapter provides some suggestions, usage guidelines, and best practices for using JDO successfully in typical real-world enterprise business applications.

Chapter 14: Current Status and the Road Ahead

This chapter provides the reader with a possible roadmap and the direction that JDO is likely to take. Features covered in this chapter are in no way guaranteed to make it into JDO 2.0, nor do they represent the limit of new features that may be considered. Rather, this chapter aims to give some insight into what may appear in future revisions of the JDO specification.

Chapter 15: Case Study

This chapter discusses a complete working example of the "Core JDO Library" to put come context around material covered in this book and to give the reader an insight into how applications can be developed with JDO. The "Core JDO Library" application is an implementation of a couple of use cases to explain basic and advanced JDO features. It is also meant to explain concepts mentioned in the previous chapters such as two-tier and n-tier applications. The chapter is divided into smaller sections that can be used as cook-book style recipes.

Appendix A: JDO States Appendix B: JDO Metadata XML DTD Appendix C: JDOQL BNF Appendix D: PersistenceManagerFactory Quick Reference Appendix E: JDO Vendors

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Core Java Data Objects (Sun Microsystems Press Java Series) 4 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
In the march towards higher levels of abstraction and more powerful coding approaches, Sun came up with Enterprise Java Beans several years ago. But despite one's best efforts, instead of focusing on writing business logic in a modular, fully encapsulated way, you often also have to deal with reading and writing to a persistent format; usually a relational database. The gritty details of the impedance mismathc between your [hopefully] object oriented approach and the latter might eat up too much of your time. Realising this, Sun devised Java Data Objects. The book describes their main promise, which is to hide away the details of persistence. The big gain is in increasing the potential developer audience, as compared with EJBs. And you have less need of expert knowledge of RDBs. Previously, that was often a de facto requirement. You can now focus on the business logic. The second gain is shown in the JDO code examples, which are often cleaner without the persistence details. Of course, any realistic business logic will have more complicated details than the simple examples in the book, but at least persistence can be pushed offline. Last year, Robin Roos wrote 'Java Data Objects' [also by the same publisher]. At that time, JDO was just getting started. Now, Sun has moved it deeper into J2EE. There is a lot more support for transactions and JDBC. JDO is no longer a speculative fling.