• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • 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?
 
Greenhorn
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.
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic