package com.cn.util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public final class HibernateUtil {
private static SessionFactory sessionFactroy;
private HibernateUtil() {
}
static {
Configuration cfg = new Configuration().configure();
sessionFactroy = cfg.buildSessionFactory();
}
public static SessionFactory getSessionFactroy(){
return sessionFactroy;
}
public static Session getSession(){
return sessionFactroy.openSession();
}
}