• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

Authors: Hibernate and Spring

Ranch Hand
Posts: 293
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patrick mentions in this post that the book takes readers through developing a naive Hibernate DAO and then enhances this using Spring.

Does the book go into any detail about Spring/Hibernate integration. Do the two products complement themselves here?
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We do cover Spring in Chapter 7, the title of which is "Organizing with Spring and data access objects". I'm a big fan of Spring's integration with Hibernate and think they compliment each other very well.

We cover using the HibernateTemplate, which is Spring's wrapper around the Session, handling opening and cleaning up the session, parsing database specific error messages to create an Exception hierachy (classes like DataIntegrityViolationException and OptimisticLockingFailureException).

We also cover using Spring to configure the Hibernate SessionFactory and datasources, as well as how to connect your DAO's, which can use Spring's layer supertype, HibernateDaoSupport. That class provides an easy connection to the SessionFactory with some useful convience methods like releaseSession(Session) and getSession().

Much of the discussion in chapter 7 aims to show why Spring is useful by implementing a DAO without Spring, then refactoring to show how much less code the Spring DAO actually requires.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic