com.alogient.cameleon.sdk.common.dao.impl.BaseDao Maven / Gradle / Ivy
The newest version!
package com.alogient.cameleon.sdk.common.dao.impl;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
/**
* Common functions of the dao layer
*
* @author alord
*/
public class BaseDao {
/**
* The session factory
*/
private SessionFactory sessionFactory;
/**
* @param sessionFactory
* the sessionFactory to set
*/
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
/**
* @return the current session obtained from the session factory
*/
public Session getCurrentSession() {
return sessionFactory.getCurrentSession();
}
/**
* @return an HibernateTemplate built from the session factory
*/
public HibernateTemplate getHibernateTemplate() {
return new HibernateTemplate(sessionFactory);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy