Hibernate 配置
2024-10-10 13:45:25
package com.shuyinghengxie.doudou; import static org.junit.Assert.*; import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.junit.Test; public class TEST01 { //测试 Hibernate连接
@Test
public void test()
{
//获取配置文件
Configuration cfg = new Configuration().configure() ; //注册配置
ServiceRegistry sr = new StandardServiceRegistryBuilder().
applySettings(cfg.getProperties()).build(); //获取SessionFactory
SessionFactory sf = cfg.buildSessionFactory(sr) ; //System.out.println(sf); sf.close(); //关闭,释放资源
} }
最新文章
- Ubuntu jdk安装
- jqueyr获取动态创建的元素
- Mysql 排名查询
- paper 107:图像的白平衡
- Ubuntu Firefox installs Flashplayer
- angularJS directive详解
- win64位 apache2.4 php5.4 mysql5.6
- iOS开发 MVVM+RAC 的使用
- 查看centos系统位数和强制关闭yum
- 洛谷 P1494 [国家集训队] 小Z的袜子
- 帆软报表(finereport) 折叠树
- 16.ajax_case01
- annotation的概念及其作用
- 关于jQuery出现的新添加元素点击事件无效
- spring boot 在不同环境下读取不同配置文件的一种方式
- Python全栈-day11-函数3
- 存储过程参数CHAR传过来null导致超时.
- MVC输出字符串常用四个方式
- Ignite内存数据库与sql支持
- 【Python学习笔记】Jupyter Lab目录插件安装
热门文章
- Java应用程序的打包和发布
- 创建数据库和表的SQL语句【转】
- 关于undefined reference to `WSASocketA@24'问题的解决
- overflow的劲爆知识点
- shell中读写mysql数据库
- 深入理解GCD(一)
- Windows下打包Python的exe可执行文件
- string转换成color转
- Asp.net Vnext Routing
- [HTML]js实现页面跳转,页面A跳到另一个页面B.以及页面传值(中文)