Pro Hibernate and. MongoDB. Anghel Leonard. Apress-

Similar documents
object/relational persistence What is persistence? 5

Contents at a Glance

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

Spring Persistence. with Hibernate PAUL TEPPER FISHER BRIAN D. MURPHY

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Eclipse Java Ejb 3.0 Tutorial For Beginners With Examples Pdf

Monday, October 31, 11

ADVANCED JAVA COURSE CURRICULUM

CO Java EE 6: Develop Database Applications with JPA

Polyglot Persistence. EclipseLink JPA for NoSQL, Relational, and Beyond. Shaun Smith Gunnar Wagenknecht

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol

Fast Track to EJB 3.0 and the JPA Using JBoss

Business Component Development with EJB Technology, Java EE 5

Migrating traditional Java EE applications to mobile

Adobe Experience Manager

JBPM Course Content. Module-1 JBPM overview, Drools overview

TABLE OF CONTENTS CHAPTER TITLE PAGE

Index. setmaxresults() method, 169 sorting, 170 SQL DISTINCT query, 171 uniqueresult() method, 169

Contents at a Glance. vii

The Definitive Guide to. NetBeans Platform 7. Heiko Bock. Apress*

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Automation through Chef Opscode

Seam 3. Pete Muir JBoss, a Division of Red Hat

How To Get Database Schema In Java Using >>>CLICK HERE<<<

Improve and Expand JavaServer Faces Technology with JBoss Seam

COPYRIGHTED MATERIAL

JVA-163. Enterprise JavaBeans

CO Java EE 7: Back-End Server Application Development

Web Application Development Using Spring, Hibernate and JPA

Developing Applications with Java EE 6 on WebLogic Server 12c

JVA-563. Developing RESTful Services in Java

com Spring + Spring-MVC + Spring-Boot + Design Pattern + XML + JMS Hibernate + Struts + Web Services = 8000/-

JPA The New Enterprise Persistence Standard

Spring & Hibernate. Knowledge of database. And basic Knowledge of web application development. Module 1: Spring Basics

Red Hat Process Automation Manager 7.0 Planning a Red Hat Process Automation Manager installation

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

Harnessing Hibernate: Step-by-step Guide To Java Persistence By James Elliott, Timothy M. O'Brien READ ONLINE

The dialog boxes Import Database Schema, Import Hibernate Mappings and Import Entity EJBs are used to create annotated Java classes and persistence.

Java EE 6: Develop Business Components with JMS & EJBs

Webservices In Java Tutorial For Beginners Using Netbeans Pdf

Web Application Development Using Spring, Hibernate and JPA

"Charting the Course... Java Programming Language. Course Summary

Introduction to JPA. Fabio Falcinelli

Java EE 7: Back-End Server Application Development

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using Spring, Hibernate and JPA

EclipseLink. Solutions Guide for EclipseLink Release 2.6. June Beta Draft

Java Platform, Enterprise Edition 6 with Extensible GlassFish Application Server v3

POJOs in Action DEVELOPING ENTERPRISE APPLICATIONS WITH LIGHTWEIGHT FRAMEWORKS CHRIS RICHARDSON MANNING. Greenwich (74 w. long.)

TopLink Grid: Scaling JPA applications with Coherence

Deployment. See Packaging and deployment processes

Oracle Exam 1z0-898 Java EE 6 Java Persistence API Developer Certified Expert Exam Version: 8.0 [ Total Questions: 33 ]

Table of Contents. I. Pre-Requisites A. Audience B. Pre-Requisites. II. Introduction A. The Problem B. Overview C. History

Practical Node.js. Building Real-World Scalable Web Apps. Apress* Azat Mardan

Hibernate Search Googling your persistence domain model. Emmanuel Bernard Doer JBoss, a division of Red Hat

Sun Java System Application Server 8.1: Administration & Deployment

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Enterprise JavaBeans, Version 3 (EJB3) Programming

Java Programming Language

Lessons learned from real-world deployments of Java EE 7. Arun Gupta, Red

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Contents. Contents... XI

Java Advance Frameworks

@jbossdeveloper. explained

ORACLE DATA SHEET KEY FEATURES AND BENEFITS ORACLE WEBLOGIC SUITE

JNoSQL (Cf) Dual Licensing Request to the Eclipse Foundation

Hibernate OGM. Michal Linhard Quality Assurance Engineer, Red Hat. Red Hat Developer Conference February 17 th, 2012

Soap Based Web Services In Java Tutorial Eclipse Jboss

Pro MongoDB Development

User s Guide 12c (12.2.1)

Oracle TopLink. Developer s Guide, Volume 4 10g ( ) B September 2006 Understanding Non-Relational Mappings

DATA ACCESS TECHNOLOGIES FOR JAVA GENERAL STUDY

Enterprise Java Development using JPA, Hibernate and Spring. Srini Penchikala Detroit JUG Developer Day Conference November 14, 2009

Spring Professional v5.0 Exam

Enterprise JavaBeans. Layer:01. Overview

Course Content for Java J2EE

DOC // JAVA TOMCAT WEB SERVICES TUTORIAL EBOOK

"Charting the Course... MOC A Developing Data Access Solutions with Microsoft Visual Studio Course Summary

Advanced Joomla! Dan Rahmel. Apress*

Building Java Persistence API Applications with Dali 1.0 Shaun Smith

Hitchhikers Guide To Modern Enterprise JavaScript. Jay Balunas Senior Engineering Manager May 4th, 2017

Developing Rules Applications with Red Hat JBoss BRMS (JB463)

An Oracle White Paper July Oracle WebLogic Suite 12c (12.1.2) Technical White Paper

Java Performance: The Definitive Guide

Java EE Architecture, Part Three. Java EE architecture, part three 1(69)

Skyway Builder 6.3 Reference

Week 2 Unit 1: Introduction and First Steps with EJB. January, 2015

TOOLING SUPPORT FOR ENTERPRISE DEVELOPMENT RYAN CUPRAK & REZA RAHMAN

Contents in Detail. Foreword by Xavier Noria

Hibernate Overview. By Khader Shaik

indx.qxd 11/3/04 3:34 PM Page 339 Index

John Hunt and Alex McManus. Key Java. Advanced Tips and Techniques

Java EE 6 & GlassFish v3 Paving the path for future. Arun Gupta Sun Microsystems, Inc.

RESTful Java with JAX-RS

Deccansoft Software Services. J2EE Syllabus

Beginning Sensor. Networks with Arduino. and Raspberry Pi. Apress- Charles Bell

Tutorial 4 Data Persistence in Java

Transcription:

Pro Hibernate and MongoDB Anghel Leonard Apress-

Contents. J About the Author xiii About the Technical Reviewer Acknowledgments Introduction xv xvii xix Chapter 1: Getting Started with Hibernate OGM 1 Features and Expectations 2 Hibernate OGM Architecture 2 Persisting Data 4 Querying Data 8 Get the Hibernate OGM Distribution 9 Getting Hibernate OGM from the Maven Central Repository 10 Getting Hibernate OGM from the Maven Command Line 11 Adding MongoDB Artifacts 14 Getting a Hibernate OGM Distribution Using the NetBeans IDE 16 Getting the Hibernate OGM Distribution Using the Eclipse IDE 19 Obtain the MongoDB Distribution 21 Summary 22 Chapter 2: Hibernate OGM and MongoDB 23 Configuring MongoDB-Hibernate OGM Properties 23 Data Storing Representation 25 Storing Entities 26 Storing Primary Keys 28 Storing Associations 29 vii

< CONTENTS Managing Transactions 35 Managing Queries 35 Summary 35 Chapter 3: Bootstrapping Hibernate OGM 37 Brief Overview of JPA 37 Brief Overview of JTA 39 MongoDB and Transactions 40 Brief Overview of Hibernate Native API 40 Bootstrapping Hibernate OGM Using JPA 41 Bootstrap Hibernate OGM Using Hibernate Native API 44 Hibernate OGM Obsolete Configuration Options 50 Summary 50 Chapter 4: Hibernate OGM at Work 51 General Prerequisites 51 Java SE and MongoDB the Hello World Example 52 Prerequisites 52 Developing 53 Testing 55 Hibernate OGM via Hibernate Native API 55 Hibernate OGM in a Non-JTA Environment (JDBC Transactions, Apache Tomcat 7) 55 Hibernate OGM in a Standalone JTA Environment (JBoss JTA, Apache Tomcat 7) 63 Hibernate OGM in a Built-in JTA Environment (no EJB, GlassFish AS 3) 71 Hibernate OGM in a Built-in JTA Environment (EJB 3/BMT, GlassFish AS 3) 76 Hibernate OGM in a Built-in JTA Environment (EJB 3/CMT, GlassFish AS 3) 80 Hibernate OGM via the Java Persistence API (JPA 2.0) 83 Hibernate OGM in a Built-in JTA Environment (EJB 3, GlassFish AS 3) 83 Hibernate OGM in a Built-in JTA Environment (EJB 3, JBoss AS 7) 88 Hibernate OGM in a Standalone JTA environment (Apache Tomcat 7) 94 viii

CONTENTS Hibernate OGM in a Built-in JTA Environment (JBoss AS 7 and Seam 3 Application) 99 Hibernate OGM in a Built-in JTA Environment (GlassFish 3 and Spring 3 Application) 107 Hibernate OGM in a non-jta Environment (RESOURCEJ.OCAL, Apache Tomcat 7) 113 Synthesis 118 Hibernate OGM via JPA in an EE Container 118 Hibernate OGM via Hibernate Native API in an EE Container 118 Hibernate OGM via JPA in Standalone JTA 119 Hibernate OGM via Hibernate Native API in Standalone JTA 119 Hibernate OGM via JPA in Non-JTA 119 Hibernate OGM via Hibernate Native API in Non-JTA 119 Summary 120 Chapter 5: Hibernate OGM and JPA 2.0 Annotations 121 Java Supported Types 121 Eager and Lazy Loading Considerations 122 Cascadable Operations Considerations 122 Entity Mapping 123 Entity Annotation 123 Old Annotation 124 Embeddedld Annotation 133 IdClass Annotation 135 Table Annotation 137 Column Annotation 138 Temporal Annotation 140 Transient Annotation 142 Embedded and Embeddable Annotations 143 Enumerated Annotation 146 Cacheable Annotation 148 MappedSuperclass Annotation 155 ElemerrtCollection Annotation 158 JPA Lifecycle Events EntityListeners, ExcludeDefaultListeners, ExcludeSuperclassListeners Annotations 163 ix

CONTENTS Version Annotation 171 Access Annotation 176 Associations 179 Direction in Entity Associations 179 Unsupported JPA 2.0 Annotations 202 Summary 203 Chapter 6: Hibernate OGM Querying MongoDB 205 MongoDB Native Query 206 Hibernate OGM and CRUD Operations 211 Hibernate Search and Apache Lucene 214 Common Steps 217 Hibernate Search/Apache Lucene Querying OGM via Native API 222 Hibernate Search/Apache Lucene Querying OGM via JPA 231 Hibernate OGM JP-QL Parser 239 Summary 240 Chapter 7: MongoDB e-commerce Database Model 241 MongoDB E-commerce Database Architecture 242 Model the Categories Collection (categories_c) 243 Model The Products Collection (products_c) 245 Model the Customers Collection (customers_c) 250 Model The Orders Collection (orders_c) 256 Model The Inventory Collection (inventory_c) 263 Summary 267 Chapter 8: MongoDB e-commerce Database Querying 269 Display the Categories of Products 271 Display the Promotional Products 273 Display the Products From a Category 274 Search for a Product by Name 276

* CONTENTS Find a Customer By E-mail And Password 277 Place an Order 278 Check the Inventory 279 Restore the Inventory 280 Considerations for Developing the Admin GUI 281 Summary 282 Chapter 9: Migrate MongoDB Database to Cloud 283 Migrating the MongoDB Database to the MongoHQ Cloud 283 Migrating the MongoDB Database to the MongoLab Cloud 289 Connecting to the MongoHQ or MongoLab Cloud Database 294 Summary 296 Chapter 10: Migrating RafaEShop Application on OpenShift 297 Creating a Free Account on OpenShift 297 Installing the OpenShift RHC Client Tools on Windows 301 Installing Ruby 301 Installing Git 302 Testing Ruby and Git from the Shell 303 Installing the OpenShift Gem 305 Fixing a Known Issue 308 Migrating the RafaEShop Application to OpenShift with JBoss AS 7 308 Monitoring the JBoss AS 7 Log 317 Commit Changes 319 Migrating the RafaEShop Application as a WAR 321 Migrating the RafaEShop Application as a Maven Project 322 Migrating the RafaEShop Application to OpenShift with GlassFish 3 AS 327 Monitoring GlassFish Start/Stop 348 Commit Changes 349 Fixing Known Issues 349 Monitoring the GlassFish Log 350 xi

CONTENTS Test It! 351 Cautions 352 Good To Know 354 Disclaimer 354 Summary 354 Index 355 xii