org.springframework.orm.hibernate.support
Class HibernateDaoSupport
- public abstract class HibernateDaoSupport
- implements InitializingBean
Convenient super class for Hibernate data access objects.
Requires a SessionFactory to be set, providing a HibernateTemplate
based on it to subclasses. Can alternatively be initialized directly via a
HibernateTemplate, to reuse the latter's settings like SessionFactory,
flush mode, exception translator, etc.
This base class is mainly intended for HibernateTemplate usage
but can also be used when working with SessionFactoryUtils directly,
e.g. in combination with HibernateInterceptor-managed Sessions.
Convenience getSession and closeSessionIfNecessary methods are provided
for that usage.
- Author:
- Juergen Hoeller
- Since: 28.07.2003
- See Also: setSessionFactory(SessionFactory), setHibernateTemplate(org.springframework.orm.hibernate.HibernateTemplate), HibernateTemplate, HibernateInterceptor
afterPropertiesSet
public final void afterPropertiesSet()
throws java.lang.Exception
setHibernateTemplate
public final void setHibernateTemplate(HibernateTemplate hibernateTemplate)
- Set the HibernateTemplate for this DAO explicitly,
as an alternative to specifying a SessionFactory.
setSessionFactory
public final void setSessionFactory(SessionFactory sessionFactory)
- Set the Hibernate SessionFactory to be used by this DAO.
to Class org.springframework.orm.hibernate.HibernateTemplate