org.sqlproc.engine.hibernate.HibernateWebSessionFactory Maven / Gradle / Ivy
package org.sqlproc.engine.hibernate;
import org.hibernate.SessionFactory;
import org.sqlproc.engine.SqlSession;
import org.sqlproc.engine.SqlSessionFactory;
/**
* The simple implementation of the factory {@link SqlSessionFactory} for the Hibernate stack. This implementation is
* sutable mainly for Web applications.
*
*
* For more info please see the Tutorials.
*
* @author Vladimir Hudec
*/
public class HibernateWebSessionFactory implements SqlSessionFactory {
/**
* The Hibernate session factory.
*/
private SessionFactory sessionFactory;
/**
* Creates a new instance.
*
* @param sessionFactory
* the Hibernate session factory
*/
public HibernateWebSessionFactory(SessionFactory sessionFactory) {
super();
this.sessionFactory = sessionFactory;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSession getSqlSession() {
return HibernateSession.generateProxy(sessionFactory.getCurrentSession());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy