Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Best practices in using Hibernate

Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron

Kindly share some of the best practices while using Hibernate. Does your book share some tips on them?

Thank you.
[ June 02, 2008: Message edited by: Swami nathan ]
author and cow tipper
Posts: 5006
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the biggest best practice is really understanding how Hibernate works, and not just 'how to do things with Hibernate.'

My book certainly discusses practices such as Open Session in Viewand how to efficiently cache the the SessionFactory object in a singleton. I discuss how to build DAO objects that have Hibernate as the persistence mechanism, and the book also demonstrates how to leverage the J2EE service pattern, but all in all, I always belive that the most fundamental best practice is understanding how Hibernate works.

When people don't really understand what's going on with Hibernate, you often see people making too many unneeded calls to save, or performing flushes or refreshes when they aren't necessary. These types of extremely common mistakes aren't really a product of not using a best practice, as much as a fundamental lack of understanding about how Hibernate works.

I do believe that this is one of the most important contributions my new Hibernate book brings to the market. Using very simple and easy to understand Hiberante tutorials, you not only learn how to use Hiberante, but you learn how it works. And having this very fundamental understanding will eliminate all of those pesky NonUniqueObjectExceptions and LazyInitializationExceptions that are the bane of Hibernate programmers. Furthermore, when those types of problems do arise, when you really understand Hibernate, you'll know how to fix them!

Kindest regards,

-Cameron McKenzie
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic