1.左上角File

File->Project Sructure->Modules 点击红色框框中的加号
idea下Springboot+JPA从数据库自动生成实体类

2.找到JPA,点击添加

idea下Springboot+JPA从数据库自动生成实体类

3.点击idea界面左上角View->Tool Windows->Persistence

idea下Springboot+JPA从数据库自动生成实体类

4.右键,找到By Database Schema

idea下Springboot+JPA从数据库自动生成实体类

5.选择数据库、映射地址等参数,若之前没有配置过Database还需要先去配置Database

idea下Springboot+JPA从数据库自动生成实体类
点击OK即可生成对应的实体类并加上JPA注解,有时候需要在实体类上加@Entity注解

相关文章: