You are previewing Java Persistence with Hibernate.
O'Reilly logo
Java Persistence with Hibernate

Book Description

Persistence -- the ability of data to outlive an instance of a program -- is central to modern applications. Hibernate, the most popular Java persistence tool, provides automatic and transparent object/relational mapping so it's a snap to work with SQL databases in Java applications. Hibernate conforms to the new EJB 3.0 and Java Persistence 1.0 standards.

Java Persistence with Hibernate explores Hibernate by developing an application that ties together hundreds of individual examples. You'll immediately dig into the rich programming model of Hibernate 3.2 and Java Persistence, working through queries, fetching strategies, caching, transactions, conversations, and more. You'll also appreciate the well-illustrated discussion of best practices in database design, object/relational mapping, and optimization techniques.

In this revised edition of Manning's bestselling Hibernate in Action, authors Christian Bauer and Gavin King -- the founder of the Hibernate project -- cover Hibernate 3.2 in detail along with the EJB 3.0 and Java Persistence 1.0 standards.

Table of Contents

  1. Praise for the First Edition
  2. foreword to the revised edition
  3. foreword to the first edition
  4. preface to the revised edition
  5. preface to the first edition
  6. acknowledgments
  7. about this book
  8. about the cover illustration
  9. Getting started with Hibernate and EJB 3.0
    1. Understanding object/relational persistence
      1. What is persistence?
      2. The paradigm mismatch
      3. Persistence layers and alternatives
      4. Object/relational mapping
      5. Summary
    2. Starting a project
      1. Starting a Hibernate project
      2. Starting a Java Persistence project
      3. Reverse engineering a legacy database
      4. Integration with Java EE services
      5. Summary
    3. Domain models and metadata
      1. The CaveatEmptor application
      2. Implementing the domain model
      3. Object/relational mapping metadata
      4. Alternative entity representation
      5. Summary
  10. Mapping concepts and strategies
    1. Mapping persistent classes
      1. Understanding entities and value types
      2. Mapping entities with identity
      3. Class mapping options
      4. Fine-grained models and mappings
      5. Summary
    2. Inheritance and custom types
      1. Mapping class inheritance
      2. The Hibernate type system
      3. Creating custom mapping types
      4. Summary
    3. Mapping collections and entity associations
      1. Sets, bags, lists, and maps of value types
      2. Collections of components
      3. Mapping collections with annotations
      4. Mapping a parent/children relationship
      5. Summary
    4. Advanced entity association mappings
      1. Single-valued entity associations
      2. Many-valued entity associations
      3. Polymorphic associations
      4. Summary
    5. Legacy databases and custom SQL
      1. Integrating legacy databases
      2. Customizing SQL
      3. Improving schema DDL
      4. Summary
  11. Conversational object processing
    1. Working with objects
      1. The persistence lifecycle
      2. Object identity and equality
      3. The Hibernate interfaces
      4. The Java Persistence API
      5. Using Java Persistence in EJB components
      6. Summary
    2. Transactions and concurrency
      1. Transaction essentials
      2. Controlling concurrent access
      3. Nontransactional data access
      4. Summary
    3. Implementing conversations
      1. Propagating the Hibernate Session
      2. Conversations with Hibernate
      3. Conversations with JPA
      4. Conversations with EJB 3.0
      5. Summary
    4. Modifying objects efficiently
      1. Transitive persistence
      2. Bulk and batch operations
      3. Data filtering and interception
      4. Summary
    5. Optimizing fetching and caching
      1. Defining the global fetch plan
      2. Selecting a fetch strategy
      3. Caching fundamentals
      4. Caching in practice
      5. Summary
    6. Querying with HQL and JPA QL
      1. Creating and running queries
      2. Basic HQL and JPA QL queries
      3. Joins, reporting queries, and subselects
      4. Summary
    7. Advanced query options
      1. Querying with criteria and example
      2. Using native SQL queries
      3. Filtering collections
      4. Caching query results
      5. Summary
    8. Creating and testing layered applications
      1. Hibernate in a web application
      2. Creating a persistence layer
      3. Introducing the Command pattern
      4. Designing applications with EJB 3.0
      5. Testing
      6. Summary
    9. Introducing JBoss Seam
      1. The Java EE 5.0 programming model
      2. Improving the application with Seam
      3. Understanding contextual components
      4. Validating user input
      5. Simplifying persistence with Seam
      6. Summary
  12. SQL fundamentals
  13. Mapping quick reference
  14. references
    1. references