注意:观看本教程需要有Hibernate Tools和Hibernate框架下载,如果你还没有该环境,可以参考以下文章
Hibernate下载与环境搭建教程 作者:叁念
在Eclipse中安装Hibernate Tools 作者:陈小子

本人第一次写博客,本人此时不懂hibernate,也是java新手一名,这不是教程也不是笔记只是单纯记录

1.创建工程,添加lib包和实体包

【记录】在eclipse下使用hibernate创建mysql****建pojo类

2.在数据库创建自己需要的表

表的结构

【记录】在eclipse下使用hibernate创建mysql****建pojo类
PS:id为自增

3.在Eclipse里连接数据库

【记录】在eclipse下使用hibernate创建mysql****建pojo类
【记录】在eclipse下使用hibernate创建mysql****建pojo类

【记录】在eclipse下使用hibernate创建mysql****建pojo类

【记录】在eclipse下使用hibernate创建mysql****建pojo类
【记录】在eclipse下使用hibernate创建mysql****建pojo类
在这里我的数据库名改为了example1

【记录】在eclipse下使用hibernate创建mysql****建pojo类

4.创建Hibernate配置文件

【记录】在eclipse下使用hibernate创建mysql****建pojo类

【记录】在eclipse下使用hibernate创建mysql****建pojo类
点Create new… 创建在src目录下,点next
【记录】在eclipse下使用hibernate创建mysql****建pojo类
【记录】在eclipse下使用hibernate创建mysql****建pojo类

5.添加Hibernate Code Generation工具

window -》 perspective -》Customize Perspective

【记录】在eclipse下使用hibernate创建mysql****建pojo类

6.运行

【记录】在eclipse下使用hibernate创建mysql****建pojo类

【记录】在eclipse下使用hibernate创建mysql****建pojo类
Create new… - 》项目 -》next -》

【记录】在eclipse下使用hibernate创建mysql****建pojo类

【记录】在eclipse下使用hibernate创建mysql****建pojo类
然后刷新相应的实体类和配置文件就生成了

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2022-01-11
  • 2021-07-27
  • 2021-08-06
  • 2022-01-01
  • 2021-05-20
  • 2021-11-30
猜你喜欢
  • 2021-06-28
  • 2021-12-16
  • 2021-09-25
  • 2021-11-10
  • 2022-12-23
  • 2021-08-08
  • 2021-12-24
相关资源
相似解决方案