⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hibernatesessionfactoryimpl.java

📁 webwork in action 源码
💻 JAVA
字号:
package org.hibernate.auction.persistence.components;import com.opensymphony.xwork.interceptor.component.Initializable;import com.opensymphony.xwork.interceptor.component.Disposable;import net.sf.hibernate.cfg.Configuration;import net.sf.hibernate.SessionFactory;import net.sf.hibernate.HibernateException;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * User: plightbo * Date: Oct 17, 2004 * Time: 11:34:42 PM */public class HibernateSessionFactoryImpl implements HibernateSessionFactory, Initializable, Disposable {    private static final Log LOG = LogFactory.getLog(HibernateSessionFactoryImpl.class);    SessionFactory sessionFactory;    public void init() {        try {            Configuration configuration = new Configuration();            sessionFactory = configuration.configure().buildSessionFactory();            // We could also let Hibernate bind it to JNDI:            // configuration.configure().buildSessionFactory()        } catch (Throwable e) {            // We have to catch Throwable, otherwise we will miss            // NoClassDefFoundError and other subclasses of Error            LOG.error("Building SessionFactory failed.", e);            throw new ExceptionInInitializerError(e);        }    }    public SessionFactory getSessionFactory() {        return sessionFactory;    }    public void dispose() {        try {            sessionFactory.close();        } catch (HibernateException e) {            LOG.error("Closing SessionFactory failed.", e);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -