Sebastopol, CA--Java and databases make a powerful combination. Getting the two sides to work together, however, takes some effort. For many Java developers, it's the least pleasant part of their work. Even database experts, who may enjoy fiddling with SQL, dread the tedious plumbing and typographical spaghetti needed to put their SQL into a Java program. It comes down to the plain fact that Java deals in objects while most databases do not. In the ongoing effort to automate the task, the Hibernate persistence framework has emerged as a powerful contender: programmers write natural Java objects and some simple configuration files, and Hibernate automates all the interactions between the objects and the database.
"Most people start out struggling to write a few SQL queries, embedding these awkwardly as strings within Java code, and working with JDBC to run them and process the results," explains James Elliott, author of Hibernate: A Developer's Notebook (O'Reilly, US $24.95). "JDBC has evolved into a rich and flexible database communication library, which now provides ways to simplify and improve on this approach, but there is still a fair degree of tedium involved. People who work with data a great deal need more power, some way of moving the queries out of the code, and making them act more like well-behaved components in an object-oriented world." A lightweight object/relational mapping service for Java, Hibernate offers a way to work easily and efficiently with information from a relational database in the form of natural Java objects, eliminating much of the tiresome process that Elliott describes.
Hibernate: A Developer's Notebook provides a hands-on introduction to this new tool, presented in a way to help experienced Java developers bypass pages of theory about the technology and instead get straight to work. The first release in the new Developer's Notebook series from O'Reilly, this concise, lab-style guide (printed on graph paper with plenty of margin space for notes) emphasizes example over explanation and practice over theory. The book focuses on learning by doing, by experimenting with tools and discovering what works.
Hibernate: A Developer's Notebook walks readers through the ins and outs of using Hibernate, from installation and configuration to complex associations and composite types. Two chapters explore ways to write sophisticated queries, which can be expressed either through a pure Java API or with an SQL-inspired but object-oriented query language. For some developers that may sound intimidating, but a surprising aspect of Hibernate is that for many of the common real-world application scenarios, an explicit query isn't needed at all.
Although there is a time and place for ten-pound tutorials, there are also times when you want to bypass the theory, roll up your sleeves, and try a new technology for yourself. If you've been meaning to add a database backend to your application, don't put it off. It's much more fun than it used to be, and Hibernate: A Developer's Notebook shows you why.
Early praise for Hibernate: A Developer's Notebook:
"I'm sitting on an airplane after finishing Hibernate: A Developer's Notebook. It's rare to find a book on a new Java technology that you can get through on a domestic flight. That this notebook effectively and succinctly tackles object-relational mapping makes it, and Hibernate, even more impressive. Many books in this category would need to be checked luggage. With this book, you travel first class."
--Mike Clark
"A simple persistence framework deserves a simple book, and this one delivers. The examples are well described and easy to understand, yet sophisticated enough to demonstrate Hibernate in a real-world context. Jim, I'm a new fan."
--Bruce Tate
Additional Resources:
- Chapter 3, "Harnessing Hibernate"
- More information about the book, including table of contents, index, author bio, and samples
- A cover graphic in JPEG format
Hibernate: A Developer's Notebook
James Elliott
ISBN 0-596-00696-9, 176 pages, $24.95 US, $36.95 CA
order@oreilly.com
1-800-998-9938; 1-707-827-7000
About O’Reilly
O’Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O’Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying “faint signals” from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.