hbnutil.java

来自「航空售票系统的代码」· Java 代码 · 共 32 行

JAVA
32
字号
package com.tarena.abs.dao;

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

public class HbnUtil {
  private static SessionFactory sf;
  static{
	try {
		sf = new Configuration()
		         .configure()
		         .buildSessionFactory();
	} catch (HibernateException e) {
		e.printStackTrace();
	}
  }
  public static Session getSession(){
	  Session s = null;
	  if(sf!=null){
		  s = sf.openSession();
	  }
	  return s;
  }
  
  
  
  
  
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?