Save India From Corruption - Anna Hazare.
Save India From Corruption - Anna Hazare.
As the MyDAOClass does not have a property sessionFactory ??
Save India From Corruption - Anna Hazare.
I had found 3 approaches for Spring and Hibernate integration by using HibernateTemplate or a HibernateDaoSupport or by DAO with the Dependency Injection pattern.
I could not grab the best approach among these . COuld you please tell me what approach to follow .
Save India From Corruption - Anna Hazare.
Vishal Pandya wrote:
As the MyDAOClass does not have a property sessionFactory ??
Inheritance. Did you check the HibernateDaoSupport class?
Vishal Pandya wrote:Ok so you don't want to use HibernateDaoSupport.
You need to define your bean definition.HibernateTemplate would be the property to that bean definition with proper name and getter-setter. That will take you to Hibernatetempalate bean definition , where you give SessionFactory as property. You don't need to have SessionFactory property to your DAO.
But why are you doing this? The use of HibernateTemplate is discouraged over Session interface. All you need to do is to extend the HibernaeDaoSupport class and provide set sessionfactory bean. And get the session through getSession method. and perform basic CRUD operations.
Consider Paul's rocket mass heater. |