Hi,
I would like to know wich is the best practice to enable OpenSessionInView and using getSessionFactory.getSession() inside a Dao implementation or is it better to use getHibernateTemplate().updateOrSave
Hi,
I would like to know wich is the best practice to enable OpenSessionInView and using getSessionFactory.getSession() inside a Dao implementation or is it better to use getHibernateTemplate().updateOrSave
Neither. Don't extend HibernateDaoSupport, simply inject the SessionFactory into your dao's. Then use the current session mechanism to retrieve the session.
Which about summarizes it.Code:public class MyDaoImpl implements MyDao { private SessionFactory sf; public void save(Object o) { sf.getCurrentSession().save(o); } }
Marten Deinum
Java Consultant / Pragmatist / Open Source Enthousiast / Author
Pro Spring MVC: With Web Flow
Conspect
Have you read the reference guide.
Use the [ code ] tags, young padawan
Well thanks for your response !