hibernateutil.java

来自「hibernate+jsf的实例」· Java 代码 · 共 37 行

JAVA
37
字号
/* * HibernateUtil.java * * Created on August 7, 2006, 8:00 AM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package hibernatetravelpojo;import org.hibernate.*;import org.hibernate.cfg.*;public class HibernateUtil {        private static final SessionFactory sessionFactory;    static {        try {            // Create the SessionFactory            sessionFactory = new Configuration().configure().buildSessionFactory();        } catch (Throwable ex) {            // Make sure you log the exception, as it might be swallowed            System.err.println("Initial SessionFactory creation failed." + ex);            throw new ExceptionInInitializerError(ex);        }    }          public static SessionFactory getSessionFactory() {           return sessionFactory;    }    }

⌨️ 快捷键说明

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