Product Details
Java Persistence with Hibernate

Java Persistence with Hibernate
By Christian Bauer, Gavin King

List Price: $59.99
Price: $37.79 & eligible for FREE Super Saver Shipping on orders over $25. Details

Availability: Usually ships in 24 hours
Ships from and sold by Amazon.com

40 new or used available from $34.75

Average customer review:

Product Description

Persistence-the ability of data to outlive an instance of a program-is central to modern applications. Hibernate, the most popular Java persistence tool, provides automatic and transparent object/relational mapping making it a snap to work with SQL databases in Java applications. Hibernate applications are cheaper, more portable, and more resilient to change. Because it conforms to the new EJB 3.0 and Java Persistence 1.0 standard, Hibernate allows the developer to seamlessly create efficient, scalable Java EE applications.

Java Persistence with Hibernate explores Hibernate by developing an application that ties together hundreds of individual examples. You'll immediately dig into the rich programming model of Hibernate 3.2 and Java Persistence, working through queries, fetching strategies, caching, transactions, conversations, and more. You'll also appreciate the well-illustrated discussion of best practices in database design, object/relational mapping, and optimization techniques.

In this revised edition of the 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 standard.


Product Details

  • Amazon Sales Rank: #14999 in Books
  • Published on: 2006-11-24
  • Format: Illustrated
  • Original language: English
  • Number of items: 1
  • Binding: Paperback
  • 904 pages

Editorial Reviews

From the Publisher
Java Persistence with Hibernate is divided into three major parts.

In Part 1, the book introduces the object/relational paradigm mismatch and explains the fundamentals behind object/relational mapping. Then, readers are walked through a hands-on tutorial to get you started with your first Hibernate, Java Persistence, or EJB 3.0 project. You look at Java application design for domain models and at the options for creating object/relational mapping metadata.

Mapping Java classes and properties to SQL tables and columns is the focus of Part 2. You explore all basic and advanced mapping options in Hibernate and Java Persistence, with XML mapping files and Java annotations. It shows you how to deal with inheritance, collections, and complex class associations. Finally, the book discusses integration with legacy database schemas and some mapping strategies that are especially tricky.

Part 3 is all about the processing of objects and how you can load and store data with Hibernate and Java Persistence. The book introduces the programming interfaces, how to write transactional and conversation-aware applications, and how to write queries. It later focuses on the correct design and implementation of layered Java applications, and the most common design patterns that are used with Hibernate, such as the Data Access Object (DAO) and EJB Command patterns. You'll see how you can test your Hibernate application easily and what other best practices are relevant if you work an object/relational mapping software.

Finally, you are introduced to the JBoss Seam framework, which takes many Hibernate concepts to the next level and enables you to create conversational web applications with ease.

Visit the Manning site for sample chapters, the Author Online Forum, errata and source code for Java Persistence with Hibernate.

About the Author
Christian Bauer is a member of the Hibernate developer team. He works as a trainer, consultant, and product manager for Hibernate, EJB 3.0, and JBoss Team at JBoss, a division of Red Hat. He is the co-author with Gavin King of Manning's best-selling Hibernate in Action.

Gavin King 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. Gavin King works as a lead developer as JBoss, a division of Red Hat.


Customer Reviews

Be prepared for some heavy reading3
Its long since I wrote a review and as I am reading this book, I felt an immediate need to write one. This book is definitely the bible for hibernate, no doubt about it. But the way its written... hibernate and jpa, annotations and xml and everything clubbed together really slows down the reader. I already read the authors defensive note. But the problem is that a reader wants to do one thing at a time and wants to quickly master it. Hopefully this will be rectified in the next version!

Stick with Hibernate in Action2
Hibernate in Action is a great book that I go back to again and again. It was very well written for a technical book.

Java Persistence with Hibernate is disappointing. The first half adds very little to what is available in Hibernate in Action and the second part is half-baked. The authors should have waited for the specs to gel and written a book purely on implementing JPA with Hibernate. They should have left out the first part of the book and pointed people to Hibernate in Action.

Bigger books are not necessarily better books.

Look elsewhere, there are better options...1
I have over 5 years of JavaEE development experience, mostly with Struts/EJB2 apps and more recently with JSF/Seam/EJB3 apps.

There is a lot of useful information in this book. This book covers a very interesting and complex topic (using Object/Relational Mapping in your persistence tier) but the book needs a lot of help. It is one of the most confusing Java books I've read and would only recommend you use it if your employer pays for it (i.e. don't buy it yourself!) Hopefully, ORM books like these will become obsolete when OODBMS takes a firm grip one day in corporate enterprise environments. But until then, we're stuck with solutions like JPA and Hibernate.

If you're writing a JSF/EJB3 application, you'll most likely use JPA 90% of the time and Hibernate for the remaining 10% that is not supported by the JPA spec (e.g. Criteria API, soon to be supported in JPA 2.0) Remember that if you ever need to port your application to another persistence provider and/or runtime environment, using the standard JPA interfaces only is an advantage over using JPA and Hibernate or TopLink API in your code.

So if you're working on a Seam application, for example, which uses JSF and EJB3, then you'll be more interested in learning about and using JPA. If you're working on a Spring/Hibernate application, then you'll be more interested in the Hibernate-specific information in this book.

Unfortunately, it's difficult to filter out the information you're interested in because the JPA and Hibernate examples are typically juxtaposed and this is extremely confusing, especially when you first begin to read this book. Often times, the authors go back and forth between Hibernate and Java Persistence in the same section, making it difficult to follow (see examples below).

For the following reasons, I am giving this book a poor review mark:

incoherent presentation of topics and explanations (e.g. section 8.2.2: integrating stored procs does not state if it's using JPA- or Hibernate-specific API or configuration in the beginning of the section and whether or not JPA even supports stored proc integration)
another example of confusion: in section 2.2.1: Using Hibernate Annotations, the authors state "let's first use Hibernate Annotations to replace the Hibernate XML mapping files." Then in the code list 2.10 we see the following import statement: "import javax.persistence.*". Are these the same as Hibernate Annotations? Perhaps similar, but if you download Hibernate Annotations 3.4.0.GA, you'll see that the @Table and @Entity interfaces are both in the org.hibernate.annotations package, not javax.persistence package. Very confusing to the reader.
sections 2.1 and 2.2 cover starting a Hibernate project and Java Persistence project, respectively. The coverage keeps switching back and forth from Hibernate and Java Persistence and it's very diffcult to read and follow.
Generally speaking, the book is too long and too heavy. It should have been released in two volumes.
Although well-written and consise, the Seam chapter is unnecessary and makes the book even longer.

cursory coverage of Hibernate 2nd level cache and whether or not the cache is available in JPA (added Cache interface in JPA 2.0)
CaveatEmptor Seam application is not available book website


Better alternatives:

Pro EJB 3: Java Persistence API by Mike Keith (uses Toplink Essentials RI persistence provider examples instead of Hibernate)
Enterprise JavaBeans 3.0 by Bill Burke (covers JPA)
POJOs in Action by Chris Richardson (covers JPA and Hibernate)
Hibernate in Action by Bauer and King
JSR-000220 Enterprise JavaBeans 3.0 Final Release (persistence)
Hibernate Forums online
Hibernate Reference Documentation online
JBoss Developer Support subscription

On a bright note, the index in this book is decent and helpful for reference purposes.