You are previewing Pro Hibernate and MongoDB.
O'Reilly logo
Pro Hibernate and MongoDB

Book Description

Hibernate and MongoDB are a powerful combination of open source persistence and NoSQL technologies for today's Java-based enterprise and cloud application developers. Hibernate is the leading open source Java-based persistence, object relational management engine, recently repositioned as an object grid management engine. MongoDB is a growing, popular open source NoSQL framework, especially popular among cloud application and big data developers. With these two, enterprise and cloud developers have a "complete out of the box" solution.

Pro Hibernate and MongoDB shows you how to use and integrate Hibernate and MongoDB. More specifically, this book guides you through the bootstrap; building transactions; handling queries and query entities; and mappings. Then, this book explores the principles and techniques for taking these application principles to the cloud, using the OpenShift Platform as a Service (PaaS) and more.

In this book, you get two case studies:

  • An enterprise application using Hibernate and MongoDB. then,

  • A cloud application (OpenShip) migrated from the enterprise application case study

After reading or using this book, you come away with the experience from two case studies that give you possible frameworks or templates that you can apply to your own specific application or cloud application building context.

What you'll learn

  • How to use and integrate Hibernate and MongoDB to be your "complete out of the box" solution for database driven enterprise and cloud applications

  • How to bootstrap; run in supported environments; do transactions; handle queries and query entities; and mappings

  • How to build an enterprise application case study using Hibernate and MongoDB

  • What are the principles and techniques for taking applications to the Cloud, using the OpenShift Platform as a Service (PaaS) and more

  • How to build a cloud-based app or application (OpenShip)

Who this book is for

This book is for experienced Java, enterprise Java programmers who may have some experience with Hibernate and/or MongoDB.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
  9. CHAPTER 1: Getting Started with Hibernate OGM
    1. Features and Expectations
    2. Hibernate OGM Architecture
    3. Get the Hibernate OGM Distribution
    4. Obtain the MongoDB Distribution
    5. Summary
  10. CHAPTER 2: Hibernate OGM and MongoDB
    1. Configuring MongoDB-Hibernate OGM Properties
    2. Data Storing Representation
    3. Managing Transactions
    4. Managing Queries
    5. Summary
  11. CHAPTER 3: Bootstrapping Hibernate OGM
    1. Brief Overview of JPA
    2. Brief Overview of JTA
    3. MongoDB and Transactions
    4. Brief Overview of Hibernate Native API
    5. Bootstrapping Hibernate OGM Using JPA
    6. Bootstrap Hibernate OGM Using Hibernate Native API
    7. Hibernate OGM Obsolete Configuration Options
    8. Summary
  12. CHAPTER 4: Hibernate OGM at Work
    1. General Prerequisites
    2. Java SE and MongoDB—the Hello World Example
    3. Hibernate OGM via Hibernate Native API
    4. Hibernate OGM via the Java Persistence API (JPA 2.0)
    5. Synthesis
    6. Summary
  13. CHAPTER 5: Hibernate OGM and JPA 2.0 Annotations
    1. Java Supported Types
    2. Eager and Lazy Loading Considerations
    3. Cascadable Operations Considerations
    4. Entity Mapping
    5. Unsupported JPA 2.0 Annotations
    6. Summary
  14. CHAPTER 6: Hibernate OGM Querying MongoDB
    1. MongoDB Native Query
    2. Hibernate OGM and CRUD Operations
    3. Hibernate Search and Apache Lucene
    4. Hibernate OGM JP-QL Parser
    5. Summary
  15. CHAPTER 7: MongoDB e-Commerce Database Model
    1. MongoDB E-commerce Database Architecture
    2. Model the Categories Collection (categories_c)
    3. Model The Products Collection (products_c)
    4. Model the Customers Collection (customers_c)
    5. Model The Orders Collection (orders_c)
    6. Model The Inventory Collection (inventory_c)
    7. Summary
  16. CHAPTER 8: MongoDB e-Commerce Database Querying
    1. Display the Categories of Products
    2. Display the Promotional Products
    3. Display the Products From a Category
    4. Search for a Product by Name
    5. Find a Customer By E-mail And Password
    6. Place an Order
    7. Check the Inventory
    8. Restore the Inventory
    9. Considerations for Developing the Admin GUI
    10. Summary
  17. CHAPTER 9: Migrate MongoDB Database to Cloud
    1. Migrating the MongoDB Database to the MongoHQ Cloud
    2. Migrating the MongoDB Database to the MongoLab Cloud
    3. Connecting to the MongoHQ or MongoLab Cloud Database
    4. Summary
  18. CHAPTER 10: Migrating RafaEShop Application on OpenShift
    1. Creating a Free Account on OpenShift
    2. Installing the OpenShift RHC Client Tools on Windows
    3. Fixing a Known Issue
    4. Migrating the RafaEShop Application to OpenShift with JBoss AS 7
    5. Migrating the RafaEShop Application to OpenShift with GlassFish 3 AS
    6. Test It!
    7. Good To Know
    8. Disclaimer
    9. Summary
  19. Index