Hibernate的搭建与配置

1、新建项目,引入junit4,记得使用javaee7.0
buildpath==》addlibraries==>myeslipse library==>javaEE7.0 library

2、在src目录下建立hibernate.cfg.xml

3、在src目录下建立log4j.properties

4、配置数据源,在第二步建好的hibernate.cfg.xml中写入以下配置内容。

5、建立一个测试类

6、在你的hibernate.cfg.xml中配置你要操作的类,包路径要全

7、写一个测试方法,进行查询操作(假如你的表中有数据)