This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Trouble passing session factory when using generic dao impl pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Trouble passing session factory when using generic dao impl pattern" Watch "Trouble passing session factory when using generic dao impl pattern" New topic
Author

Trouble passing session factory when using generic dao impl pattern

Stuart Rogers
Ranch Hand

Joined: Oct 02, 2008
Posts: 133
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

Joined: Oct 02, 2008
Posts: 133
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble passing session factory when using generic dao impl pattern
 
Similar Threads
Hiberante transaction in Spring
How to Use Spring AOP for Auditing?
Sychronization problem with hibernate and weblogic 9.2 JTA
Null Pointer on sessionFactory.getCurrentSession
problem with hibernate integration