Meera Subbarao has a Bachelors degree in Electronics and Communication Engineering and seventeen years of software programming experience around the globe, from Bangalore,India to Dubai,United Arab Emirates, to the United States. She has spent the past six years at DataSource, Inc. in Maryland and has been working on J2EE technologies exclusively for the last six years. She is a Sun Certified Java Programmer as well as a Sun Certified Web Component Developer. Meera is also the Team Leader for the Javalobby/dzone book review team.
| Author(s) | Christian Bauer and Gavin King |
|---|---|
| Publisher | Manning |
| PubDate | 2006 |
| Reviewer | Meera Subbarao |
Java persistence with Hibernate is the revised edition of Manning's bestselling Hibernate in Action. It covers Hibernate 3.2 in detail along with the EJB 3.0 and Java Persistence 1.0 standards. This book is for developers who are using Hibernate as their persistence tool or for those who want to get started with Hibernate.
The book covers Hibernate 3.2 in detail along with the EJB 3.0 and Java Persistence 1.0 standards. Readers can get started with Hibernate and Java Persistence at the same time. If you are an experienced Hibernate user, this book provides the insight you need to benefit immediately from the new standard, its rich programming model, and the latest version of Hibernate.
PART 1 - Getting started with Hibernate and EJB3, the authors show you why object persistence is such a complex topic and what solutions you can apply in practice. Once you are done reading this part, you'll know why you need ORM, how Hibernate, JPA and EJB 3.0 work in practice. You'll have also written your first simple project.
Chapter 1 - Understanding object/relational persistence, the first few sections define persistent data management in the context of object-oriented applications. The next section covers the so-called object/relational paradigm mismatch and the common problems we encounter in object-oriented software development with relational databases. The last few sections cover the various Hibernate software modules, and how effectively you can combine them to work with Hibernate only, or with JPA and EJB 3.0. If you are already familiar with all these, I suggest you can easily skip reading this chapter.
Chapter 2 - Starting a project, you will learn how to create a simple "Hello World" application using Hibernate as well as Java Persistence. This chapter also gives a brief introduction to Ant and build scripts that can not only compile and run the project, but also utilize the Hibernate Tools. You'll see how to use the Hibernate toolset to export database schemas automatically or even to reverse-engineer a complete application from a legacy database schema. Don't miss reading the Hibernate and JPA comparison at the end of the chapter.
Chapter 3 - Domain models and metadata, as in the previous version this chapter also covers the CaveatEmptor, an online auction system example application to demonstrate Hibernate and Java Persistence. In this chapter, you'll see how to design and implement a domain model, and which mapping metadata options is the best choice in a larger project. In the last section of this chapter, you can find out how this latest version of Hibernate allows you to represent a domain model without Java classes using Map or Dom4j.
PART 2 - Mapping concepts and strategies, is all about object/relational mapping, complex class inheritance hierarchies, how to map Java collections and associations between classes, with many more examples. After you finish reading this part, you'll be able to create complex mappings, understand how the problem of inheritance can be solved and also tune and customize Hibernate for integration with any existing database schema.
Chapter 4 - Mapping persistent classes, covers the basic mapping options and how to handle database identity and primary keys. The authors very well explain how object identity and equality relate to database entity. As mentioned earlier, don't skip the Hibernate and JPA comparison at the end of this chapter.
Chapter 5 - Inheritance and custom types, in this chapter, you will learn how inheritance hierarchies of entities can be mapped to the database with the four basic strategies. You will also see how these inheritance mapping strategies can be mixed for a particular hierarchy and when each one is appropriate.
Chapter 6 - Mapping collections and entity associations, is a tough concept to understand and you should read this chapter a couple of times and also try out the code as per the Authors and I whole heartedly agree with them. This chapter introduces collection mappings and discusses how you can handle collections of value typed objects. An entire section is devoted for mapping a parent/children relationship.
Chapter 7 - Advanced entity association mappings, one-to-one, many-to-one, one-to-many and many-to-many entity associations with all kinds of multiplicity with and without collections are covered very neatly in this chapter.
Chapter 8 - Legacy databases and custom SQL, covers everything you need to know when you have to deal with legacy databases and as the author clearly mentions a weird or broken schema. If you don't have to deal with a legacy database, you can easily skip this chapter which is more than 50 pages. This chapter is all about complex mapping, customization of SQL statements and improving the SQL schema with custom DDL.
Part 3 - Conversational Object Processing, focuses on how to work with persistent objects, Hibernate and Java Persistence programming interfaces. You'll also learn how transactions work and then implement conversations, write complex queries and apply the best fetching and catching strategy to increase performance.
Chapter 9 - Working with objects, gives a solid understanding of the lifecycle and states of objects, also covers working with Hibernate API and Java Persistence API. As usual, don't forget to take a look at the Hibernate and JPA comparison chart.
Chapter 10 - Transactions and concurrency, explains how Hibernate handles database transactions, concurrency, isolation, and locking. It also covers transactions with Hibernate as well as Java Persistence, and nontransactional data access.
Chapter 11 - Implementing conversations, you'll learn how to implement conversations with Hibernate, JPA and EJB 3.0 components, how to propagate the current Hibernate session and the persistence context to create more complex layered applications without leaking concerns.
Chapter 12 - Modifying objects efficiently, the first few sections cover transitive state changes, and bulk operations in HQL and JPA QL and how to write batch procedures. The last section, shows you how to enable data filtering and finally, the Hibernate Interceptor extension point, the Hibernate core event system, and the JPA entity callback mechanism.
Chapter 13 - Optimizing fetching and caching, covers global fetching strategies, caching in theory and in practice. You'll also be able to configure and enable second-level caching with the local EHCache provider, and a cluster-enabled JBoss Cache.
Chapter 14 - Querying with HQL and JPA QL, this deals extensively with querying and how to write and execute HQL, JPA QL, SQL, and criteria queries with Hibernate as well as JPA. The authors also have several sections which show you restriction, projection, joins subselects and many other options.
Chapter 15 - Advanced query options, focuses on more advanced query techniques, such as querying with criteria and example APIs, embedding native SQL queries, collection filters and query cache and when you should enable it.
Chapter 16 - Creating and testing layered applications, the authors finally bring all the pieces together and focus in this chapter on the design and architecture of applications with Hibernate, JPA and EJB 3.0 components. If you have never worked with TestNG, the final section is a must read.
Chapter 17 - Bonus chapter: Introducing JBoss Seam. JBoss Seam is a new application framework for building Web 2.0 applications by integrating technologies such as AJAX, Java Server Faces (JSF), Enterprise Java Beans (EJB3), Java Portlets and Business Process Management (BPM).
This chapter introduces you to the JBoss Seam framework. This chapter covers, web application development with JSF and EJB 3.0, improving your web applications with Seam, integrating Seam with Hibernate Validator and managing persistence contexts with Seam.
Appendix A SQL fundamentals, if you have read until this point, you definitely know the basics of SQL and can easily skip this.
Appendix B Mapping quick reference, just 2 paragraphs and the authors tell you from where to get all the mapping reference.
I highly recommend this book if you are interested in learning Hibernate 3.2 and JPA specification or even if you want to choose between the two technologies. Since this book is the revised version of Hibernate in Action, and as I did mention about the earlier version, this book is the ultimate solution. If you are going to use Hibernate in your application, you have no other choice, go rush to the store and get this book.
| Relevance | |
|---|---|
| Readability | |
| Overall | |