I'm a newbie to Spring. May be this question sound a childish, but still i need some help in this problem.
In a DAO which extends HibernateDaoSupport, i have a method named findByProperty in which i call
The problem is i get a nullPointerException for getHibernateTemplate() method.
I have defined a sessionFactory in application-context.xml. Also the DAO has a reference to the sessionFactory bean through sessionFactory property in the application-context.xml file.
Thanks for the suggestion, i tried it but still it is throwing a nullPointerException for getHibernateTemplate() method.
Anyway, the database is defined in hibernate.cfg.xml and passed to the sessionFactory bean as a property, so do i need to set the dataSource property again???
I'm confused with why getHibernateTemplate() throwing a NullPointerException..... The sessionFactory is defined in application-context.xml, so the sessionFactory is set, isnt it? Or are there any sessionFactory bean injection to be done in order to get the HibernateTemplate???
Nevermind what I said, haven't seen the dataSource properties configured in your hibernate-config. I have no idea why hibernateTemplate is null; have you tried not to use it? By the way, it's use is discouraged.
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad: