PacktLib: Spring Persistence with Hibernate

Spring Persistence with Hibernate

Credits

About the Author

About the Reviewer

Preface

An Introduction to Hibernate and Spring

Persistence management in Java

Object relational mapping

Hibernate as an O/R Mapping solution

Hibernate architecture

What is Spring

Summary

Preparing an Application to Use Spring with Hibernate

Setting up the database

Getting a Hibernate distribution

Getting a Spring distribution

Setting up the project hierarchy

Setting up Ant or Maven in the project

Summary

A Quick Tour of Hibernate and Spring

Getting started with Hibernate

Hibernate declarative configuration

Some issues in mapping

Getting started with Spring

Hibernate with Spring

Summary

Hibernate Configuration

Basic configuration information

Hibernate dialect

Configuring Hibernate

Using a single instance of SessionFactory

JPA configuration

Summary

Hibernate Mappings

Persistent entity classes

Object/relational mapping metadata

Mapping inheritance hierarchy

Summary

More on Mappings

Mapping components

Mapping collections

Mapping object associations

Summary

Hibernate Types

Built-in types

Custom types

Summary

Hibernate Persistence Behavior

The life cycle of persistent objects

Persistence with Hibernate

Cascading operations

Lazy loading

Some useful Session methods

Summary

Querying In Hibernate

The Session API and querying

HQL

Bulk updates and bulk deletes with HQL

Queries in native SQL

Named SQL and HQL queries

Using the Criteria API

Paging the query result

Logging the Hibernate-Generated SQL

Summary

Inversion of Control with Spring

Inversion of Control and dependency injection

Inversion of Control in Spring

Applying IoC to Hibernate resources

PropertyEditors

Summary

Spring AOP

Introduction to AOP

Using Spring AOP with Spring IoC: An example

Spring's AOP framework

Moving to Spring 2.x's AOP

Summary

Transaction Management

Transaction essentials

Transactions in Hibernate applications

Spring transaction abstraction

Caching

Summary

Integrating Hibernate with Spring

The Data Access Object pattern

Service Facade Pattern

Data tier implementation with Hibernate

Data tier implementation with Spring

Spring exception translation

Refactoring DAO classes to use Spring

Configuring Hibernate in a Spring context

Spring transaction management

Summary

Web Development with Hibernate and Spring

Problem definition

The MVC architectural pattern

Spring MVC web framework

Summary

Testing

An introduction to unit testing

Unit testing with JUnit

Integration testing data-access layer

Testing Inversion of Control

Unit testing using mocks

Automating tests with Ant

Summary

Some of Hibernate's Advanced Features

Some of Hibernate's Advanced Features

Some of Hibernate's Advanced Features

Some of Hibernate's Advanced Features

Some of Hibernate's Advanced Features

Some of Hibernate's Advanced Features

Index