testsessionfactory.java
来自「springGather 在JAVA环境开发的电信运营支持系统」· Java 代码 · 共 34 行
JAVA
34 行
package lianxi;
import org.hibernate.*;
import org.hibernate.cfg.*;
public class TestSessionFactory{
private static TestSessionFactory instance = null;
private static String key = "key";
private SessionFactory factory = null;
private TestSessionFactory(){
}
public static TestSessionFactory getInstance(){
if(instance == null){
synchronized(key){
if(instance == null){
instance = new TestSessionFactory();
instance.init();
}
}
}
return instance;
}
public void init(){
factory = new Configuration().addClass(org.com.gather.BIDR.class).buildSessionFactory();
}
public Session getHibernateSession(){
return factory.openSession();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?