Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Hibernate Quickly

Inside the book

About this book Sample Chapters Table of Contents Index Preface Source Code Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Hibernate Quickly
Patrick Peak and Nick Heudecker

2005 | 456 pages
ISBN: 1932394419
$44.95 Softbound print book  
$22.50 PDF ebook  

Table of Contents


preface xv
acknowledgments xvii
about this book xviii
about the cover illustration xxiv

1 Why Hibernate?
Understanding object persistence
Identity - Inheritance - Associations - Object/relational mapping
Using direct JDBC
Example application - Retrieving object graphs using JDBC - Persisting object graphs to a relational model - Deleting object graphs - Querying object graphs
Persistence with Hibernate
Simplicity and flexibility - Completeness - Performance
Summary
2 Installing and building projects with Ant
Getting a Hibernate distribution
Installing Ant - Getting Ant - Extracting and installing Ant
Setting up a database
Getting MySQL - Testing MySQL - MySQL drivers
Setting up a project
Defining directories - Ant 101 - Running Ant
Habits of highly effective build files
Connecting Hibernate - Reusable build files - Expanding your horizons
Summary
3 Hibernate basics
Configuring Hibernate
Basic configuration
Creating mapping definitions
IDs and generators - Properties - Many-to-one element - Proxies - Collections - Cascades - Fetching associated objects
Building the SessionFactory
Configuring the SessionFactory
Persisting objects
Retrieving objects
The Session cache
Advanced configuration
Connection pools - Transactions - Cache providers
Inheritance
Table per class hierarchy - Table per subclass
Summary
4 Associations and components
Associations
Many-to-one relationships, in depth - The central configuration file - Defining sample data
Building tables with Ant and SchemaExport
Logging with log4j and Commons Logging - Running SchemaExport - Loading the Events - Refactoring - Finding Events - Cascades
Components
What's in a component? - Mapping a component - Why use a component?
Summary
5 Collections and custom types
Persisting collections and arrays
Using interfaces - Mapping persistent collections - Collection types - Lazy collections - Sorted collections - Bidirectional associations - Cascading collections
Implementing custom types
UserTypes - Implementing CompositeUserTypes
Summary
6 Querying persistent objects
Using HQL
session.find(…) - The Query interface - Outer joins and HQL - Show SQL
Query substitutions - Query parser
Querying objects with HQL
The FROM clause - Joins - Selects - Using functions - HQL properties - Using expressions
Criteria queries
Stored procedures
Hibern8IDE
Summary
7 Organizing with Spring and data access objects
The ubiquitous DAO pattern
Keeping the HQL together
Analyzing the DAO
Boilerplate code - Potential duplication - Detached objects only
The Layer Supertype pattern
Creating an AbstractDao
The Spring Framework
What's in a template? - Beans and their factories
Summary
8 Web frameworks: WebWork, Struts, and Tapestry
Defining the application
A quick overview of MVC
Service Layer pattern
Decoupling Hibernate from the web layer
Working with detached objects - Session scope - Accessing the Session from the Controller - Accessing the Session from the Service layer
WebWork
WebWork fundamentals - Creating controllers
Struts
Struts fundamentals - Building Struts Actions
Tapestry
Getting started - Tapestry fundamentals - HTML views - Page controller - Page specification - web.xml
Hibernate in the view layer
Summary
9 Hibernating with XDoclet
Essential XDoclet
JavaDoc basics - XDoclet: Building your own tags - Installing XDoclet - Configuring Ant
Making single objects persistent
The @hibernate.class tag - The @hibernate.id tag - The @hibernate.property tag - The @hibernate.column tag
Basic relationships
The @hibernate.many-to-one tag - The @hibernate.component tag
Building collections
One-to-many: a kicking set of Speakers - The @hibernate.set tag - The @hibernate.collection-key - The @hibernate.collection-one-to-many tag
Going where no XDoclet has gone before
Merge points - Property substitution
Generating the hibernate.cfg.xml file
Summary
10 Unit testing with JUnit and DBUnit
Introduction to unit testing
Automate those tests - Assertions - Expect failures
JUnit
Test-infecting your build file - Polishing off the build file
Testing the persistence layer
What do we want to test? - Testing basic persistence - Testing queries - General database testing tips 331
Testing with DBUnit
Loading test data - ProjectDatabaseTestCase
Summary
11 What's new in Hibernate 3
Filters
Mapping improvements
Multiple table mapping - Discriminator formulas - Union subclasses - Property references
Dynamic classes
Annotations
Stored procedures and SQL
Persistence events
Lazy properties
Summary


Appendix: The complete Hibernate mapping catalog
Index

DESCRIPTION

"I highly recommend this book."
- Christopher Haupt, Senior Engineering Manager, Adobe Systems Inc.

"If you want to learn Hibernate quickly, this book shows you step by step."
- Sang Shin, Java Technology Architect, Sun Microsystems

Positioned as a layer between the application and the database, Hibernate is a powerful object/relational persistence and query service for Java. It takes care of automating a tedious task: the manual bridging of the gap between object oriented code and the relational database. Hibernate Quickly gives you all you need to start working with Hibernate now.

The book focuses on the 20% you need 80% of the time. The pages saved are used to introduce you to the Hibernate "ecosystem": how Hibernate can work with other common development tools and frameworks like XDoclet, Struts, Webwork, Spring, and Tapestry.

The book builds its code examples incrementally, introducing new concepts as it goes. It covers Hibernate's many, useful configuration and design options, breaking a complex subject into digestible pieces. With a gradual "crawl-walk-run" approach, the book teaches you what Hibernate is, what it can do, and how you can work with it effectively.

What's Inside

  • Writing mapping files and creating associations
  • Hibernate with XDoclet, Struts, Webwork, Spring, and Tapestry
  • Querying persistent objects
  • Using web application architecture
  • Testing with JUnit and Ant

ABOUT THE AUTHORS...

Patrick Peak is the CTO of a firm that emphasizes open source frameworks and tools for competitive advantage. He lives in Arlington, Virginia.

Nick Heudecker has large scale development experience with projects for Fortune 500 clients, the media, and government. He lives in Chicago, Illinois.

Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.