• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trouble passing session factory when using generic dao impl pattern

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings all,

I've got a Hibernate3/Spring3 webapp working where each domain's dao and daoimpl is explicity typed out.
I'm now trying to convert it to using the GenericDao/GenericDaoImpl pattern but am having trouble
passing the session factory into GenericDaoImpl.

GenericDao


GenericDaoImpl


SquawDao


SquawDaoImp


applicationContext.xml


executing the following does print the correct domain name in GenericDaoImpl.findAll but also finds
sessionFactory to be null on the line commented with an "OOPS"

LiveTestCase


It's SOOOOOOOO close to working - what am I missing?

Thanks in advance,

Still-learning Stuar
 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The missing piece was the abstract=true parameter in the bean for genericDao ... so now you can have a bean for the abstract class and inject the sessionFactory param as usual.

CASE CLOSED!


Still-learning Stuart
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic