Preface
Hibernate is a lightweight object/relational mapping service for Java. What does that mean? It’s a way to work easily and efficiently with information from a relational database in the form of natural Java objects. But that description doesn’t come close to conveying how useful and exciting the technology is. I’m not the only person who thinks so: Hibernate 2.1 won Software Development magazine’s 14th annual Jolt Award in the “Libraries, Frameworks, and Components” category. (And, with the hindsight afforded by the opportunity to write this updated and expanded version of Hibernate: A Developer’s Notebook, I can say I was truly thrilled that the first edition of this book, which covered Hibernate 2, was itself a Productivity Winner in the 15th annual Awards.)
So, what’s great about Hibernate? All nontrivial applications (and even many trivial ones) need to store and use information, and these days this usually involves a relational database. Worlds apart from Java objects, databases often involve people with different skills and specializations. Bridging these two worlds has been important for a while, but it used to be quite complex and tedious.
Most people start out struggling to write a few SQL queries, embedding these awkwardly as strings within Java code, and working with Java database connectivity (JDBC) to run them and process the results. JDBC has evolved into a rich and flexible database communication library, which now provides ways to simplify and improve upon this ...