Persistence with Hibernate

I had spend some time looking at hibernate (2.0) a few years back and used it like a magical solution for rapid development. I believe its time for me to study hibernate in detail. I am listing down my learnings for sharing and my benefit as well 🙂 (Best way to learn is to share)

A product built on top of certain technology is going to take away a bit of flexibility from you.
I saw my DB expert friends at SCA Technologies do things that hibernate take away at cost of easier development. Performance is not something that hibernate boasts about as well. But there were certain issues that creeped up during application development which were not as simple as a SQLException. So to avoid all again lets look at hibernate again..

— Some notes on hibernate

1. Semantics of saveOrUpdate / merge / update. These methods have a documented behavior for transient or persistent objects. Check Hibernate documentation/javadocs for details.
2. inverse=true makes a lot of difference.
3. Hibernate has different log categories that can be used to print interesting things.
4. Hibernate loads everthing if eager fetching is on. Profile your app for memory requirements and if you actually need that much data.
5. Flush mode/jdbc batch size/select-before-update are a few interesting things.
6. For TransientObject exceptions check if you have a bidi relationship.