Berkeley DB Collections Tutorial

Legal Notice

This documentation is distributed under the terms of the Sleepycat public license. You may review the terms of this license at:

Sleepycat Software, Berkeley DB, Berkeley DB XML and the Sleepycat logo are trademarks or service marks of Sleepycat Software, Inc. All rights to these marks are reserved. No third-party use is permitted without the express prior written consent of Sleepycat Software, Inc.

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

To obtain a copy of this document's original source code, please write to .


Table of Contents

Conventions Used in this Book
1. Introduction
Developing a Sleepycat 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 Sleepycat 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