Features
- Cover Type: Paperback with 904 pages
- Published by: Manning Publications
- Edition: Revised Edition November 24, 2006
- Written in: English
- ISBN 10 Number: 1932394885
- ISBN 13 Number: 978-1932394887
-
Book Dimensions:
9.2 x 7.4 x 2 inches
- Weighs: 3.2 pounds
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.
Publisher Description
Java Persistence with Hibernate is divided into three major parts.
In Part 1, the book introduces the object/relational paradigm mismatch and explains the basics 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.
Reader ReviewsHibernate is an ambitious project that aims to be a complete solution to the problem of managing persistent data in java. With the most recent version (3.2) out in the wild now, it is better than ever. A whole slew of new features have been added, a bunch of them improved from its earlier incarnation, but to trump it all - hibernate now supports the new EJB 3.0 standard for persistence, named JPA. As a matter of fact, Gavin King, creator of hibernate, was one among the expert group members for that JSR and helped shape its API. This book aims to be a definitive source of reference for both hibernate and its JPA implementation. The authors undertake an arduous task of explaining each and every detail both in hibernate and JPA parlance. The end result is a comprehensive tutorial/reference guide of both worlds in one well-written and easy-to-read book. Think about this, if your goal is to to learn only hibernate, you have it here, or if all you need is to learn the JPA specification, you got that here too. The most beneficial of all, if you wanted to learn both, compare and contrast them, and make an informed decision of the best approach for your next project, then you are still in the right place. Can this get any better? Keep reading. With a whopping 850+ pages, this book has loads of information for a reader at any experience level. The entire subject area is broadly organized into 3 parts. Part 1: Getting started with Hibernate and JPA Part 2: Mapping concepts and strategies Part 3: Conversational object processing Part 1 introduces you to the object/relational paradigm mismatch - both structural and conceptual aspects. Then, we are taken through a tour of how to start a new hibernate project. The authors then lay-out the types of projects that will benefit from ORM and those that wont. Based on the conclusion that the projects with rich domain model will best benefit from ORM, we are then briefly introduced to the art of creating rich domain models using an example application (Caveat Emptor). This example application will be used throughout the rest of the book to explain various concepts and strategies. Part 2 is largely about the most important concept of hibernate - mapping classes to tables. Starting with the simplest scenario, the authors discuss every possible use-case that may present itself in a data-driven application and provide a mapping solution for the same. One-to-One, One-to-Many, Many-to-One, Many-to-Many, Inheritance mapping, component mapping, mapping collections of components and many more are discussed in detail, along with recommendations on which one to use when. The authors also discuss the pitfalls when taking a bottom-up approach and its solutions. Every chapter explains the mapping meta-data in all 3 formats - hibernate XML, JPA XML and JPA annotations. Since JPA has some limitations, every possible limitation is pointed out and ways to get back to native hibernate to achieve the same effect is discussed. Part 3 is a complete tutorial on the API for storing and retrieving objects. The authors start with the basics of how to persist, retrieve, query etc., and proceed by dedicating entire chapters for every advanced concept. Transactions & Concurrency, Implementing Conversations, Modifying objects efficiently, Retrieving objects using query and criteria api all receive their own chapters. Every chapter explains the API in both native hibernate as well as JPA parlance. Whenever a JPA limitation is encountered, the authors show the best fall-back strategy to native hibernate. Towards the end, the authors briefly show us the art and science of writing layered applications with hibernate. As an added bonus, we also get a primer into JBoss Seam, which solves many problems related to writing layered applications using the now famous EJB 3.0 specification. Two appendices, one explaining the fundamentals of SQL and the other acting as a reference for mapping concepts are also very useful. The authors are very ambitious in trying to cover all the features of both Hibernate 3.x and JPA specification. This is an arduous task and kudos for just aiming for that level of comprehensiveness. Praises aside, i am not very impressed with the ad-hoc approach taken to explain both these giants side-by-side. Some chapters clearly separate hibernate and JPA sections, whereas some chapters entangle them into a mess. I personally preferred the chapters that clearly separated these sections. That gives me the choice, as a reader, to select one or the other, and to focus on my choice. But for some reason, most chapters chose to discuss them in an entangled fashion leaving me more confused than i was before the start. I was expecting at least a primer on Hibernate/Lucene integration, but the authors chose to safely eliminate the topic, probably because the feature is still in its infancy. Also, it was strange that there was no trace of spring framework anywhere in the book, knowing for a fact that spring has a lot to offer to any ORM implementation. Though there is room for improvement, there is currently no match for this book in terms of the coverage offered. Explanations are lucid, examples are excellent, and the author's ability to foresee the next questions in the reader's mind and address them immediately is fabulous . I highly recommend this book - For those who are interested in learning hibernate 3.x and JPA specification - For those who crave practical advices for real-world scenarios - For those who wish to choose between native hibernate and JPA, based on facts, not just techno-babble In case you are wondering what i chose, i chose native hibernate.