Hibernate 官方单例获取sessionFactoty
来源:互联网 发布:visio网络拓扑图模板 编辑:程序博客网 时间:2024/05/16 00:37
package com.newer;
import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
/**
* Hibernate官方提供的工具类
*/
public class HibernateUtil {
private static final SessionFactory sessionFactory; //单态模式
static{
try {
sessionFactory=new AnnotationConfiguration().
configure("hibernate.cfg.xml").buildSessionFactory(); //加载配置
} catch (HibernateException e) {
System.err.println("加载配置错误"+e);
throw new ExceptionInInitializerError(e); //抛出异常
}
}
public static SessionFactory getSessionfactory() {
return sessionFactory;
}
}
- Hibernate 官方单例获取sessionFactoty
- Hibernate中的SessionFactoty 、Session、Configuration
- 获取HIbernate 的SessionFactory (创建一个单例)
- 苹果官方的单例写法
- 比较官方的单例模式
- iOS单例模式的官方写法
- 【Hibernate】Hibernate构建单例SessionFactory
- Hibernate使用jdbc只能获取单字符问题
- Unity获取GameObject单例
- Mybatis 单例获取SqlSessionFactory
- hibernate官方入门教程 (转载)
- hibernate官方faq摘录
- hibernate官方文档
- hibernate官方入门教程
- hibernate官方入门教程 (转载)
- hibernate官方入门教程 (转载)
- hibernate官方入门教程 (转载)
- hibernate官方入门教程
- Linux Shell编程(基础教程)
- Asp.net中web.config配置文件详解
- GCC and Make Compiling, Linking and Building C/C++ Applications
- C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别
- [转]goAhead 2.5嵌入式web服务器移植到arm9 2440 + linux中
- Hibernate 官方单例获取sessionFactoty
- iphone妖机+黑机不能上网解决方案
- PHPUnit学习笔记(三)测试方法进阶
- Android学习笔记07:Handler的使用一
- Hibernate 通用的添加实体方法
- scanf与gets函数混用
- Hibernate 工具类
- windowsphone开发listbox滚到底
- tcpcopy安装及其测试