Java Persistence With Hibernate BY Christian Bauer and Gavin King

Java Persistence With Hibernate BY Christian Bauer and Gavin King
Java Persistence With Hibernate BY Christian Bauer and Gavin King
Book Details:
Book Title: Java Persistence With Hibernate
Author: Christian Bauer & Gavin King
Paperback: 876 Pages
Publisher: Dreamtech Press
Year: 2006
Language: English
ISBN-10: 817722719X
ISBN-13: 978-8177227192
Download: PDF (10.3 MB)
Buy @ Amazon

CONTENTS:
PART 1 – Getting Started with Hibernate and EJB 3.0
Chapter 1: Understanding Object/Relational Persistence
1.1 What is Persistence?
Relational Databases
Understanding SQL
Using SQL in Java
Persistence in Object-Oriented Applications
1.2 The Paradigm Mismatch
The Problem of Granularity
The Problem of Subtypes
The Problem of Identity
Problems Relating to Associations
The Problem of Data Navigation
The Cost of the Mismatch
1.3 Persistence Layers and Alternatives
Layered Architecture
Hand-Coding a Persistence Layer with SQL/JDBC
Using Serialization
Object-Oriented Database Systems
Other Options
1.4 Object/Relational Mapping
What is ORM?
Generic ORM Problems
Why ORM?
Introducing Hibernate, EJB3, and JPA
1.5 Summary

Chapter 2: Starting a Project
2.1 Starting a Hibernate Project
Selecting a Development Process
Setting up the Project
Hibernate Configuration and Startup
Running and Testing the Application
2.2 Starting a Java Persistence Project
Using Hibernate Annotations
Using Hibernate EntityManager
Introducing EJB Components
Switching to Hibernate Interfaces
2.3 Reverse Engineering a Legacy Database
Creating a Database Configuration
Customizing Reverse Engineering
Generating Java Source Code
2.4 Integration with Java EE Services
Integration with JTA
JNDI-Bound SessionFactory
JMX Service Deployment
2.5 Summary

Chapter 3: Domain Models and Metadata
3.1 The CaveatEmptor Application
Analyzing the Business Domain
The CaveatEmptor Domain Model
3.2 Implementing the Domain Model
Addressing Leakage of Concerns
Transparent and Automated Persistence
Writing POJOs and Persistent Entity Classes
Implementing POJO Associations
Adding Logic to Accessor Methods
3.3 Object/Relational Mapping Metadata
Metadata in XML
Annotation-Based Metadata
Using XDoclet
Handling Global Metadata
Manipulating Metadata at Runtime
3.4 Alternative Entity Representation
Creating Dynamic Applications
Representing Data in XML
3.5 Summary

PART 2 - Mapping Concepts and Strategies
Chapter 4: Mapping Persistent Classes
4.1 Understanding Entities and Value Types
Fine-Grained Domain Models
Defining the Concept
Identifying Entities and Value Types
4.2 Mapping Entities with Identity
Understanding Java Identity and Equality
Handling Database Identity
Database Primary Keys
4.3 Class Mapping Options
Dynamic SQL Generation
Making an Entity Immutable
Naming Entities for Querying
Declaring a Package Name
Quoting SQL Identifiers
Implementing Naming Conventions
4.4 Fine-Grained Models and Mappings
Mapping Basic Properties
Mapping Components
4.5 Summary

Chapter 5: Inheritance and Custom Types
5.1 Mapping Class Inheritance
Table Per Concrete Class with Implicit Polymorphism
Table Per Concrete Class with Unions
Table Per Class Hierarchy
Table Per Subclass Mixing Inheritance Strategies
Choosing a Strategy
5.2 The Hibernate Type System
Recapitulating Entity and Value Types Built-In Mapping Types
Using Mapping Types
5.3 Creating Custom Mapping Types
Considering Custom Mapping Types
The Extension Points
The case for Custom Mapping Types
Creating a UserType
Creating a CompositeUserType
Parameterizing Custom Types
Mapping Enumerations
5.4 Summary

Chapter 6: Mapping Collections and Entity Associations
6.1 Sets, Bags, Lists, and Maps of Value Types
Selecting a Collection Interface
Mapping a Set
Mapping an Identifier Bag
Mapping a List
Mapping a Map
Sorted and Ordered Collections
6.2 Collections of Components
Writing the Component Class
Mapping the Collection
Enabling Bidirectional Navigation
Avoiding Not-Null Columns
6.3 Mapping Collections with Annotations
Basic collection Mapping
Sorted and Ordered Collections
Mapping a Collection of Embedded Objects
6.4 Mapping a Parent/Children Relationship Multiplicity
The Simplest Possible Association Making the Association Bidirectional
Cascading Object State
6.5 Summary

Chapter 7: Advanced Entity Association Mappings
7.1 Single-Valued Entity Associations
Shared Primary Key Associations
One-To-One Foreign Key Associations
Mapping with a Join Table
7.2 Many-Valued Entity Associations
One-To-Many Associations
Many-To-Many Associations
Adding Columns to Join Tables
Mapping Maps
7.3 Polymorphic Associations
Polymorphic Many-To-One Associations
Polymorphic Collections
Polymorphic Associations to Unions
Polymorphic Table Per Concrete Class
7.4 Summary

Chapter 8: Legacy Databases and Custom SQL
8.1 Integrating Legacy Databases
Handling Primary Keys
Arbitrary Join Conditions with Formulas
Joining Arbitrary Tables
Working with Triggers
8.2 Customizing SQL
Writing Custom CRUD Statements
Integrating Stored Procedures and Functions
8.3 Improving Schema DDL
Custom SQL Names and Datatypes
Ensuring Data Consistency
Adding Domains and Column Constraints
Table-Level Constraints
Database Constraints
Creating Indexes
Adding Auxiliary DDL
8.4 Summary

PART 3 – Conversational Object Processing
Chapter 9: Working with Objects
9.1 The Persistence Lifecycle Object States
The Persistence Context
9.2 Object Identity and Equality
Introducing Conversations
The Scope of Object Identity
The Identity of Detached Objects
Extending a Persistence Context
9.3 The Hibernate Interfaces
Storing and Loading Objects
Working with Detached Objects
Managing the Persistence Context
9.4 The Java Persistence API
Storing and Loading Objects
Working with Detached Entity Instances
9.5 Using Java Persistence in EJB Components
Injecting an EntityManager
Looking up an EntityManager
Accessing an EntityManagerFactory
9.6 Summary

Chapter 10: Transactions and concurrency
10.1 Transaction Essentials
Database and System Transactions
Transactions in a Hibernate Application
Transactions with Java Persistence
10.2 Controlling Concurrent Access
Understanding Database-Level Concurrency
Optimistic Concurrency Control
Obtaining Additional Isolation Guarantees
10.3 Nontransactional Data Access
Debunking Autocommit Myths
Working Nontransactionally with Hibernate
Optional Transactions with JTA
10.4 Summary

Chapter 11: Implementing Conversations
11.1 Propagating the Hibernate Session
The use case for Session Propagation
Propagation through Thread-Local
Propagation with JTA
Propagation with EJBs
11.2 Conversations with Hibernate
Providing Conversational Guarantees
Conversations with Detached Objects
Extending a Session for a Conversation
11.3 Conversations with JPA
Persistence Context Propagation in Java SE
Merging Detached Objects in Conversations
Extending the Persistence Context in Java SE
11.4 Conversations with EJB 3.0
Context Propagation with EJBs
Extended Persistence Contexts with EJBs
11.5 Summary

Chapter 12: Modifying Objects Efficiently
12.1 Transitive Persistence
Persistence by Reachability
Applying Cascading to Associations
Working with Transitive State
Transitive Associations with JPA
12.2 Bulk and Batch Operations
Bulk Statements with HQL and JPA QL
Processing with Batches
Using a Stateless Session
12.3 Data Filtering and Interception
Dynamic Data Filters
Intercepting Hibernate Events
The Core Event System
Entity Listeners and Callbacks
12.4 Summary

Chapter 13: Optimizing Fetching and Caching
13.1 Defining the Global Fetch Plan
The Object-Retrieval Options
The Lazy Default Fetch Plan
Understanding Proxies
Disabling Proxy Generation
Eager Loading of Associations and Collections
Lazy Loading with Interception
13.2 Selecting a Fetch Strategy
Prefetching Data in Batches
Prefetching Collections with Subselects
Eager Fetching with Joins
Optimizing Fetching for Secondary Tables
Optimization Guidelines
13.3 Caching Fundamentals
Caching Strategies and Scopes
The Hibernate Cache Architecture
13.4 Caching in Practice
Selecting a Concurrency Control Strategy
Understanding Cache Regions
Setting up a Local Cache Provider
Setting up a Replicated Cache
Controlling the Second-Level Cache
13.5 Summary

Chapter 14: Querying with HQL and JPA QL
14.1 Creating and Running Queries Preparing a Query
Executing a Query
Using Named Queries
14.2 Basic HQL and JPA QL Queries
Selection
Restriction
Projection
14.3 Joins, Reporting Queries, and Subselects
Joining Relations and Associations
Reporting Queries
Using Subselects
14.4 Summary

Chapter 15: Advanced Query Options
15.1 Querying with Criteria and Example
Basic Criteria Queries
Joins and Dynamic Fetching
Projection and Report Queries
Query by Example
15.2 Using Native SQL Queries
Automatic Resultset Handling
Retrieving Scalar Values
Native SQL in Java Persistence
15.3 Filtering Collections
15.4 Caching Query Results
Enabling the Query Result Cache
Understanding the Query Cache
When to use the Query Cache
Natural Identifier Cache Lookups
15.5 Summary

Chapter 16: Creating and Testing Layered Applications
16.1 Hibernate in a Web Application
Introducing the Use Case
Writing a Controller
The Open Session in View Pattern
Designing Smart Domain Models
16.2 Creating a Persistence Layer
A Generic Data-Access Object Pattern
Implementing the Generic CRUD Interface
Implementing Entity DAOs
Using Data-Access Objects
16.3 Introducing the Command Pattern
The Basic Interfaces
Executing Command Objects
Variations of the Command Pattern
16.4 Designing Applications with EJB 3.0
Implementing a Conversation with Stateful Beans
Writing DAOs with EJBs
Utilizing Dependency Injection
16.5 Testing
Understanding Different Kinds of Tests
Introducing
TestNG
Testing the Persistence Layer
Considering Performance Benchmarks
16.6 Summary

Chapter 17: Introducing JBoss Seam
17.1 The Java EE 5.0 Programming Model
Considering JavaServer Faces
Considering EJB 3.0
Writing a Web Application with JSF and EJB 3.0
Analyzing the Application
17.2 Improving the Application with SEAM
Configuring SEAM
Binding Pages to Stateful Seam Components
Analyzing the Seam Application
17.3 Understanding Contextual Components
Writing the Login Page
Creating the Components
Aliasing Contextual Variables
Completing the Login/Logout Feature
17.4 Validating User Input
Introducing Hibernate Validator
Creating the Registration Page
Internationalization with Seam
17.5 Simplifying Persistence with Seam
Implementing a Conversation
Letting Seam Manage the Persistence Context
17.6 Summary
Appendix A: SQL Fundamentals
Appendix B: Mapping Quick Reference
References
Index

About Book:
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. The book ends with detailed coverage of JBoss Seam, a revolutionary web application framework for Java EE that builds on EJB 3.0, JavaServer Faces, and Hibernate concepts.

About Author:
Christian Bauer is a member of the Hibernate developer team and a trainer, consultant, and product manager for Hibernate, EJB 3.0, and JBoss Seam at JBoss. Gavin King, a lead developer at JBoss, is the founder of the Hibernate project, and a member of the EJB 3.0 (JSR 220) expert group. He also leads the Web Beans JSR 299, a standardization effort involving Hibernate concepts, JSF, and EJB 3.0.

Comments