Hibernate: A Developer's Notebook

Book description

Do you enjoy writing software, except for the database code? Hibernate:A Developer's Notebook is for you. Database experts may enjoy fiddling with SQL, but you don't have to--the rest of the application is the fun part. And even database experts dread the tedious plumbing and typographical spaghetti needed to put their SQL into a Java program. Hibernate: A Developers Notebook shows you how to use Hibernate to automate persistence: you write natural Java objects and some simple configuration files, and Hibernate automates all the interaction between your objects and the database. You don't even need to know the database is there, and you can change from one database to another simply by changing a few statements in a configuration file. Hibernate: A Developer's Notebook walks you through the ins and outs of using Hibernate, from installation and configuration, to complex associations and composite types. Two chapters explore ways to write sophisticated queries, which you can express either through a pure Java API, or with an SQL-inspired, but object-oriented, query language. Don't let that intimidate you though: one of the biggest surprises in working with Hibernate is that for many of the common real-world application scenarios, you don't need an explicit query at all. If you've needed to add a database backend to your application, don't put it off. It's much more fun than it used to be, and Hibernate: A Developer's Notebook shows you why. Here's what a few reviewers had to say: "I'm sitting on an airplane after finishing Hibernate: A Developer's Notebook. It's rare to find a book on a new Java technology that you can get through on a domestic flight. That this notebook effectively and succinctly tackles object-relational mapping makes it, and Hibernate, even more impressive. Many books in this category would need to be checked luggage. With this book, you travel first class." --Mike Clark "A simple persistence framework deserves a simple book, and this one delivers. The examples are well described and easy to understand, yet sophisticated enough to demonstrate Hibernate in a real-world context. Jim, I'm a new fan." --Bruce Tate About the new Developer's Notebook Series from O'Reilly: Developer's Notebooks are a new book series covering important new tools for software developers. Developer's Notebooks stress example over explanation and practice over theory. They are about learning by doing; by experimenting with tools and discovering what works. "All lab, no lecture," with a thoughtful lab partner to guide the way.

Table of contents

  1. Hibernate: A Developer's Notebook™
  2. Preface
    1. How to Use This Book
    2. Font Conventions
    3. On the Web Site
    4. How to Contact Us
    5. Acknowledgments
  3. Installation and Setup
    1. Getting an Ant Distribution
    2. Getting the HSQLDB Database Engine
    3. Setting Up a Project Hierarchy
  4. Introduction to Mapping
    1. Writing a Mapping Document
    2. Generating Some Class
    3. Cooking Up a Schema
    4. Connecting Hibernate to MySQL
  5. Harnessing Hibernate
    1. Creating Persistent Objects
    2. Finding Persistent Objects
    3. Better Ways to Build Queries
  6. Collections and Associations
    1. Mapping Collections
    2. Persisting Collections
    3. Retrieving Collections
    4. Using Bidirectional Associations
    5. Working with Simple Collections
  7. Richer Associations
    1. Using Lazy Associations
    2. Ordered Collections
    3. Augmenting Associations in Collections
    4. Lifecycle Associations
    5. Reflexive Associations
  8. Persistent Enumerated Types
    1. Defining a Persistent Enumerated Type
    2. Working with Persistent Enumerations
  9. Custom Value Types
    1. Defining a User Type
    2. Using a Custom Type Mapping
    3. Building a Composite User Type
  10. Criteria Queries
    1. Using Simple Criteria
    2. Compounding Criteria
    3. Applying Criteria to Associations
    4. Querying by Example
  11. A Look at HQL
    1. Writing HQL Queries
    2. Selecting Properties and Pieces
    3. Sorting
    4. Working with Aggregate Values
    5. Writing Native SQL Queries
  12. Hibernate Types
    1. Basic Types
    2. Persistent Enumerated Types
    3. Custom Value Types
    4. "Any" Type Mappings
    5. All Types
  13. Standard Criteria
    1. The Expression Factory
  14. Hibernate SQL Dialects
    1. Getting Fluent in the Local SQL
  15. About the Author
  16. Colophon
  17. Index

Product information

  • Title: Hibernate: A Developer's Notebook
  • Author(s): James Elliott
  • Release date: May 2004
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596006969