ssh中DAO中 util工具类 经典代码

xiaoxiao2021-02-27  500

 

 

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(); } }

 

转载请注明原文地址: https://www.6miu.com/read-1587.html

最新回复(0)