You are previewing Beginning Hibernate, Third Edition.
O'Reilly logo
Beginning Hibernate, Third Edition

Book Description

Beginning Hibernate, Third Edition is ideal if you're experienced in Java with databases (the traditional, or "connected," approach), but new to open-source, lightweight Hibernate, a leading object-relational mapping and database-oriented application development framework.

This book packs in information about the release of the Hibernate 4.x persistence layer and provides a clear introduction to the current standard for object-relational persistence in Java. And since the book keeps its focus on Hibernate without wasting time on nonessential third-party tools, you'll be able to immediately start building transaction-based engines and applications.

Experienced authors Joseph Ottinger with Dave Minter and Jeff Linwood provide more in-depth examples than any other book for Hibernate beginners. The authors also present material in a lively, example-based manner—not a dry, theoretical, hard-to-read fashion.

What you'll learn

  • How to build enterprise Java-based transaction-type applications that access complex data with Hibernate

  • How to work with Hibernate 4

  • Where to integrate into the persistence life cycle

  • How to map using annotations, Hibernate XML files, and more

  • How to search and query with the new version of Hibernate

  • How to integrate with MongoDB using NoSQL

  • Who this book is for

    This book is for Java developers who want to learn about Hibernate.

    Table of Contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Authors
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. CHAPTER 1: An Introduction to Hibernate 4.2
      1. Plain Old Java Objects (POJOs)
      2. Origins of Hibernate and Object/Relational Mapping
      3. Hibernate as a Persistence Solution
      4. A Hibernate Hello World Example
      5. Mappings
      6. Persisting an Object
      7. Summary
    10. CHAPTER 2: Integrating and Configuring Hibernate
      1. The Steps Needed to Integrate and Configure Hibernate
      2. Understanding Where Hibernate Fits into Your Java Application
      3. Deploying Hibernate
      4. Connection Pooling
      5. Summary
    11. CHAPTER 3: Building a Simple Application
      1. A Simple Application
      2. Summary
    12. CHAPTER 4: The Persistence Life Cycle
      1. Introducing the Life Cycle
      2. Entities, Classes, and Names
      3. Identifiers
      4. Entities and Associations
      5. Saving Entities
      6. Object Equality and Identity
      7. Loading Entities
      8. Merging Entities
      9. Refreshing Entities
      10. Updating Entities
      11. Deleting Entities
      12. Cascading Operations
      13. Lazy Loading, Proxies, and Collection Wrappers
      14. Querying Objects
      15. Summary
    13. CHAPTER 5: An Overview of Mapping
      1. Why Mapping Cannot Easily Be Automated
      2. Primary Keys
      3. Lazy Loading
      4. Associations
      5. Other Supported Features
      6. Summary
    14. CHAPTER 6: Mapping with Annotations
      1. Creating Hibernate Mappings with Annotations
      2. JPA 2 Persistence Annotations
      3. Configuring the Annotated Classes
      4. Hibernate-Specific Persistence Annotations
      5. Summary
    15. CHAPTER 7: JPA Integration and Lifecycle Events
      1. The Java Persistence Architecture
      2. Lifecycle Events
      3. External Entity Listeners
      4. Data Validation
      5. Summary
    16. CHAPTER 8: Using the Session
      1. Sessions
      2. Transactions and Locking
      3. Caching
      4. Threads
      5. Summary
    17. CHAPTER 9: Searches and Queries
      1. Hibernate Query Language (HQL)
      2. Syntax Basics
      3. Named Queries
      4. Logging and Commenting the Underlying SQL
      5. The from Clause and Aliases
      6. The select Clause and Projection
      7. Using Restrictions with HQL
      8. Using Named Parameters
      9. Paging Through the Result Set
      10. Obtaining a Unique Result
      11. Sorting Results with the order by Clause
      12. Associations
      13. Aggregate Methods
      14. Bulk Updates and Deletes with HQL
      15. Using Native SQL
      16. Summary
    18. CHAPTER 10: Advanced Queries Using Criteria
      1. Using the Criteria API
      2. Associations
      3. Distinct Results
      4. Projections and Aggregates
      5. Query By Example (QBE)
      6. Summary
    19. CHAPTER 11: Filtering the Results of Searches
      1. When to Use Filters
      2. Defining and Attaching Filters
      3. Using Filters in Your Application
      4. A Basic Filtering Example
      5. Summary
    20. CHAPTER 12: Leaving the Relational Database Behind: NoSQL
      1. Where Is Hibernate When it Comes to NoSQL?
      2. Basic CRUD Operations
      3. MongoDB
      4. Summary
    21. APPENDIX: More Advanced Features
      1. Managed Versioning and Optimistic Locking
      2. Limitations of Hibernate
      3. Hand-Rolled SQL
      4. Invoking Stored Procedures
      5. Overriding the Default Constructor
      6. Summary
    22. Index