用myeclipse 9.0建立一个带有hibernate的项目

1、新建一个java project

2、选择 myeclipse database explorer

3、新建一个数据库的链接(前提是安装好了数据库)

4、为java project 添加 file->myeclipse->add hibernate capabilities

5、按照向导建立hibernate的配置,hibernate.cfg.xml

6、建立表和类之间的映射:打开 myeclipse database explorer,选择要映射的数据表 ,选择hibernate reverse enginneer

7、生成映射文件和POJO类,注意类名要写包含包名的全名

————用JUNIT进行测试——————————————————

1、选择要测试的类文件

2、右键new->junit test case

3、生成测试文件

—————监控hibernate—————————————————————

参见:http://www.ibm.com/developerworks/cn/java/j-lo-p6spy/index.html

 

posted on 2011-09-13 23:13  cjnong  阅读(1292)  评论(0编辑  收藏  举报