这里介绍IDEA根据数据库逆向生成Entity,数据库为Mysql。


具体实现

IDEA连接Mysql

  • View -》Tool Windows -》Database 调出Database面板

SpringBoot - IDEA逆向生成Entity

  • "✚" -》Data Source -》数据库类型

SpringBoot - IDEA逆向生成Entity

  • 新建数据源

SpringBoot - IDEA逆向生成Entity

  • 连接建立如下:

SpringBoot - IDEA逆向生成Entity


逆向生成Entity

  • View -》Tool Windows -》Persistence调出Persistence面板
  • 注:Persistence面板找不到看文章最后一节

SpringBoot - IDEA逆向生成Entity

  • 项目右键 -》Generate Persistence Mapping -》By Database Schema

SpringBoot - IDEA逆向生成Entity

  • 选择数据源、生成包目录、勾选需要生成的数据表,点击OK

SpringBoot - IDEA逆向生成Entity

  • 生成结果如下

SpringBoot - IDEA逆向生成Entity


Persistence面板调出

注: 在View -》Tool Windows -》中找不到Persistence面板时可根据如下步骤调出:

  • 点击View -》Project Structure,调出Project Structure面板。
  • 在调出Project Structure面板的项目名上右键 -》Add -》JPA ,给项目添加JPA模块。
  • 在JPA面板中下方的Default JPA Provider选项选择JPA的提供者Hibernate,点击OK。
- End -
梦想是咸鱼
关注一下吧
SpringBoot - IDEA逆向生成Entity

相关文章:

  • 2021-04-24
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2021-07-17
  • 2021-10-10
  • 2022-02-21
猜你喜欢
  • 2021-09-22
  • 2021-09-17
  • 2021-05-26
  • 2022-12-23
  • 2021-11-26
  • 2021-06-13
  • 2022-12-23
相关资源
相似解决方案