码迷,mamicode.com
首页 > Web开发 > 详细

hibernate核心开发接口_Configuration

时间:2015-10-03 13:07:20      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

AnnotationConfiguration继承自Configuration,这里以AnnotationConfiguration为例:

new AnnotationConfiguration().configure().buildSessionFactory();

AnnotationConfiguration().configure()会默认找src下的hibernate.cfg.xml,读取配置信息。
* 最主要的是数据库连接信息,帮你做出连接池。SessionFactory代表着跟数据库的连接。
* configure()有个重载方法 configure(String resource)可以指定配置文件文件名;如果配置文件叫hibernate.xml,
* 就configure("hibernate.xml"),默认去classpath下找配置文件。

hibernate核心开发接口_Configuration

标签:

原文地址:http://www.cnblogs.com/lihaoyang/p/4853226.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!