📄 hibersession.java
字号:
/* * HiberSession.java * * Created on 2006年9月26日, 下午7:31 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package com.shopping.resource;import org.hibernate.*;import org.hibernate.cfg.*;/** * * @author 曹昊 */public class HiberSession { private static SessionFactory sf = null; static { Configuration cfg = new Configuration(); sf = cfg.configure("com/shopping/hibernate/hibernate.cfg.xml").buildSessionFactory(); } /** *得到SessionFactory */ public static SessionFactory getSf() { return sf; } /** *得到Session */ public static Session getSession(){ Session sess=getSf().openSession(); return sess; } /** Creates a new instance of HiberSession */ private HiberSession() { } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -