标签:style blog color io div sp log on c
1 package com.cn; 2 3 import org.hibernate.Session; 4 import org.hibernate.SessionFactory; 5 import org.hibernate.cfg.Configuration; 6 7 public final class HibernateUitl { 8 private static SessionFactory sessionFactory; 9 10 private HibernateUitl() { 11 } 12 13 static { 14 Configuration cfg = new Configuration(); 15 cfg.configure(); 16 sessionFactory = cfg.buildSessionFactory(); 17 } 18 19 public static SessionFactory getSessionFactory() { 20 return sessionFactory; 21 } 22 23 public static Session getSession() { 24 return sessionFactory.openSession(); 25 } 26 }
标签:style blog color io div sp log on c
原文地址:http://www.cnblogs.com/thrive/p/3981540.html