willjava

导航

 

HibernateUtil.java:

package com.zwh.user.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
    private static SessionFactory sessionFactory = null;
    
    static {
        sessionFactory = new Configuration().configure().buildSessionFactory();
    }
    
    public static Session openSession() {
        return sessionFactory.openSession();
    }
}

 

posted on 2014-03-29 00:27  威尔爪哇  阅读(103)  评论(0)    收藏  举报