UKUUG home


(the UK's Unix & Open Systems User Group)






Book Discounts

Other Discounts

Mailing lists






Hibernate: A Developer's Notebook James Elliot
Published by O'Reilly Media
190 pages
£ 17.50
Published: 27th May 2004
reviewed by Mats Henrikson
   in the September 2004 issue (pdf), (html)

The O'Reilly book Hibernate: A Developer's Notebook is an introductory book about the Hibernate object persistence framework. It assumes that the reader has quite a good knowledge of the Java language and some knowledge of SQL and relational databases. It does not assume that the reader has any previous experience of Hibernate.

I have been looking at object persistence frameworks for a while now, to try and get away from having to manage large amounts of JDBC code in my projects. The only other framework I have looked at in detail is Java Data Objects (JDO), which unfortunately requires a byte code enhancer to be run on your compiled classes which makes it cumbersome to use. Hibernate on the other hand does not require a byte code enhancer, as it only requires that classes implement the interface. The rest of the magic is taken care of by putting Object/Relational (O/R) mappings in XML files. This makes Hibernate a much more attractive and simpler to use option than JDO. Hibernate also has a number of other nice features, such as Java source and database schema generation from the XML O/R mapping files.

The book reads a little like a Dummies book although it is not at all as basic. The text contains the occasional spelling mistake, but it is not any worse than any of the other first edition O'Reilly books I have read. The style of the writing is short and concise and not overly wordy, making reading and understanding it very easy. There are frequent explanations and code examples spread out in the text to illustrate how to use Hibernate by writing a small sample project.

All but the last chapters rely on the reader either completing the previous chapters exercises or downloading the source available from the book's web site. The first chapters are very easy if the reader is familiar with how to get and install Java libraries and the Ant build tool. The first chapter is all about installation and configuration, while the second two show how to actually use Hibernate for persistence. The next two chapters show how to store Java Collections using Hibernate. There is then a chapter on enumerated types, followed by a chapter on how to create custom types that can be used to wrap around objects not initially intended for persistence. The next chapter is the most interesting in the book, as it shows how to find and retrieve persistent objects in a programmatical way. This makes it possible to catch most errors at compile time, instead of at runtime as would usually happen with a query that originated as an embedded string. The final chapter then goes into more detail on how to use the Hibernate Query Language (HQL), and also how it is possible to use SQL with Hibernate instead if the reader so prefers. After that follows three brief appendices and an index.

Overall, the book tells the reader what they need to know, and usually says when the online reference documentation have more useful detail on a particular subject if it is outside the scope of the book. It is not really a book that will be used very much for reference except for a few key parts, as the online documentation is quite good. It soon becomes apparent that the book will not remove the need to know SQL and relational database concepts in general. It would in fact be quite a difficult read for somebody with no knowledge about indexes and constraints on columns, how data is stored and retrieved from the database, and at least a little about good database design. What the book does show though is how to get by using a minimal amount of JDBC code, with the added benefits of being able to let Hibernate do most of the database schema for you and generate the Java source code required for your persistent classes.

The book could go into more detail in places, as well as discussing some more advanced topics, but the aim of the Notebook series is to be shorter, more of an introduction than a complete reference, and as an introduction it works well. It is quite short, and it is possible that there are other topics that could have been discussed without having made the book too advanced or too long. As it is it feels like quite an abrupt ending, although it does refer the reader to the Hibernate website and the reference documentation found there. Even so, I think that the author does what he set out to do, he manages to introduce the reader to Hibernate in a nice and easy way instead of being tedious, and I think this makes it quite a good read.

Back to reviews list

Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
More information

Page last modified 02 Apr 2007
Copyright © 1995-2011 UKUUG Ltd.