Berkeley DB Collections Tutorial

Legal Notice

This documentation is distributed under an open source license. You may review the terms of this license at: http://www.oracle.com/technology/software/products/berkeley-db/htdocs/oslicensing.html

Oracle, Berkeley DB, and Sleepycat are trademarks or registered trademarks of Oracle Corporation. All rights to these marks are reserved. No third-party use is permitted without the express prior written consent of Oracle Corporation.

Java™ and all Java-based marks are a trademark or registered trademark of Sun Microsystems, Inc, in the United States and other countries.

To obtain a copy of this document's original source code, please submit a request to the Oracle Technology Network forum at: http://forums.oracle.com/forums/forum.jspa?forumID=271

9/20/2006


Table of Contents

Preface
Conventions Used in this Book
For More Information
1. Introduction
Features
Developing a DB Collections Application
Tutorial Introduction
2. The Basic Program
Defining Serialized Key and Value Classes
Opening and Closing the Database Environment
Opening and Closing the Class Catalog
Opening and Closing Databases
Creating Bindings and Collections
Implementing the Main Program
Using Transactions
Adding Database Items
Retrieving Database Items
Handling Exceptions
3. Using Secondary Indices
Opening Secondary Key Indices
More Secondary Key Indices
Creating Indexed Collections
Retrieving Items by Index Key
4. Using Entity Classes
Defining Entity Classes
Creating Entity Bindings
Creating Collections with Entity Bindings
Using Entities with Collections
5. Using Tuples
Using the Tuple Format
Using Tuples with Key Creators
Creating Tuple Key Bindings
Creating Tuple-Serial Entity Bindings
Using Sorted Collections
6. Using Serializable Entities
Using Transient Fields in an Entity Class
Using Transient Fields in an Entity Binding
Removing the Redundant Value Classes
7. Summary
A. API Notes and Details
Using Data Bindings
Selecting Binding Formats
Record Number Bindings
Selecting Data Bindings
Implementing Bindings
Using Bindings
Secondary Key Creators
Using the Java Collections API
Using Transactions
Transaction Rollback
Selecting Access Methods
Access Method Restrictions
Using Stored Collections
Stored Collection and Access Methods
Stored Collections Versus Standard Java Collections
Other Stored Collection Characteristics
Why Java Collections for Berkeley DB
Serialized Object Storage