Book Chapter: Hibernate in Action: Practical Object/Relational Mapping

Java Development News:

Book Chapter: Hibernate in Action: Practical Object/Relational Mapping

By Christian Bauer and Gavin King

11 May 2006 | TheServerSide.com

Table of Contents
1. Understanding object/relational persistence
2. Introducing and Integrating Hibernate
3. Mapping persistent classes
4. Working with persistent objects
5. Transactions, concurrency, and caching
6. Advanced mapping concepts
7. Retrieving objects efficiently
8. Writing Hibernate applications
9. Using the toolset
Appendix A - SQL Fundamentals
Appendix B - ORM implementation strategies
Appendix C - Back in the real world

Hibernate in Action: Practical Object/Relational Mapping


Note: Note: Hibernate In Action is now available everywhere that technical books are sold. Read Chapter 2 - Introducing and Integrating Hibernate. To find out more and order visit www.manning.com/bauer.

Download Chapter 2 - Introducing and Integrating Hibernate

The Book

In modern applications, persistence is not merely a matter of an application saving and restoring its state. A persistence mechanism organizes and structures persistent data. It manages concurrent access to that data. It ensures integrity of the data. Most importantly, it provides a mechanism to sort, search and aggregate data. In many cases, a relational database is the lowest common denominator in an heterogenous software environment.

{{{/books/review/bookreviews-portlet.html}}}

Object-oriented development is most powerful when entities in the business domain are modelled using purely object-oriented notions like inheritence, polymorphism, encapsulation and association. Unfortunately, the SQL-based relational databases found in almost all enterprise environments do not properly support these modelling techniques. Hence, many applications implement two different models of the some business entities. Transformations between the Java object model and the persistent relational model are often complex, tedious and costly to implement.

Object/Relational Mapping (ORM) is the name given to automated solutions to this transformation problem - known as the object/relational impedance mismatch. For developers weary of tedious persistence code, the good news is that ORM has finally come of age. Applications built with an ORM tool can be expected to be cheaper, more performant, more portable and more resilient in the face of changes to the internal object or underlying relational models. The most astonishing thing is that these benefits are now available to Java developers for free - Hibernate is a mature open source ORM solution for Java that is being used with great success in many different problem domains.

Hibernate in Action is both an introduction to the theoretical aspects of automated object/relational mapping and a practical guide to the use of Hibernate. The extensive example code implements an online auction application.

The book is divided into two parts. Part I discusses object persistence, the object/relational mismatch problem and emphasizes the importance of Plain Old Java Objects. It introduces Hibernate and explains the basic theoretical foundations of object/relational mapping.

Part II is dedicated to demonstrating more advanced ORM concepts and techniques, with practical examples using Hibernate. The impact of ORM upon application architecture and development processes is explored along with techniques for achieving high performance. Hibernate's developer toolset is demonstrated and best practices are recommended.

What's inside:

  • In-depth coverage of ORM concepts
  • Practical ORM examples with Hibernate
  • Solutions to real-world problems with an example application
  • Discussion of development processes, application architecture and best practices
  • Introduction to popular open source tools (XDoclet, Middlegen, Ant) for roundtrip development with Hibernate


How you can help

The chapters of the Hibernate book are being made available for the purposes of review to allow the community to participate in the review and editing of the chapters of the book. Your comments and suggestions may make it into the final product, if appropriate. You can help us write this book, by correcting or enhancing the chapters. We will provide chapters in Word format, so you can make changes as you read along. Check the chapter header to learn how to submit feedback, or just send a note to hibernate@manning.com with your corrections and suggestions.


The Authors

Christian Bauer is a member of the Hibernate core developer team; he maintains the extensive Hibernate documentation and website. He works as a senior software engineer in Frankfurt, Germany.

Gavin King is the founder of the Hibernate project. He is a J2EE consultant based in Melbourne, Australia. He is an enthusiastic proponent of agile development, open source software and "lightweight" Java frameworks.