Hibernate is a de facto standard for object-relational mapping. One of my recent projects involved the use of the latest version of Hibernate (3.2). Since I had not used Hibernate since its version 2 days, I picked up the authoritative reference Java Persistence with Hibernate which is co-authored by Gavin King, the founder of Hibernate. I carefully perused the book prior to starting development and found it useful and comprehensive.
As development proceeded, however, I discovered a number of surprises that Hibernate threw my way and a number of seemingly common issues that arose that I either could not find in the book or were inadequately covered. So I wanted to share these Hibernate tips & tricks with you. Rather than produce one large article consisting of a collection of unrelated tips, I decided to produce separate articles, each on a focused subject. Below I list these specific tips & tricks articles:
- Hibernate and Logging: Provides tips on how to log the SQL created by Hibernate.
- Avoid Non-Lazy Relationships: Why lazy relationships should always be used.
- Improving Performance via Eager Fetching in Hibernate: How eager fetching works and how to use it.
- Automatically Populating Audit Columns in Hibernate: How to easily populate audit columns for your entire application.
- Avoiding Caching To Improve Hibernate Performance: When overuse of Hibernate's cache can hurt performance.
If you find this article helpful, please make a donation.
I wrote a post recently (today) on Hibernate which you might be interested in – http://www.alvinsingh.org/blog/. The top is dynamically routing tables in Hibernate.