The book

I want to provide you with an easy-to-follow introduction to Java Persistence and Hibernate including not only code snippets but complete working examples. For this reason the guide is based on the following principles:

Explanations with complete working examples Whenever something is explained you will find a complete sample application. If a specific mapping is demonstrated you can find a sample application, too. It shows how to insert, update, delete or query the classes included in this mapping. Larger sample applications show the implementation of real applications using Hibernate in detail. Each application has an increasing complexity. Cache configurations, deployment configurations for particular application server rounds off the examples. Altogether the book provides about 30 mapping examples + variations, 4 real projects and some smaller projects showing a specific configuration.

Potential problems are investigated in detail Hibernate has some problem zones where you can easily make mistakes. These are covered in detail to help you to avoid these problems. Some topics are LazyLoading, Session and transaction handling, optimistic concurrency and version handling.

Best Practices One chapter is completely focussing on how to implement well designed Hibernate applications. DAO patterns and business layers are discussed. Pros and cons and the logic behind this structure are explained.

Focus on important features Deliberately, I did not explain some rare concepts which I consider to be either not stable or very rarely used. Instead I referred to the corresponding chapters of the Hibernate reference - the documentation available with Hibernate. In my opinion the Hibernate reference is far too complex for people learning Hibernate. However, it is a valuable resource for people who already know Hibernate.

What this book is not… The texts are short and frequently you are referred to parts of sample applications. If you prefer larger narrative parts you should not read this book. Feel free to contact me and to comment on the book in the forum at

Best Regards / Viele Grüße

Sebastian Hennebrueder