springboot集成Spring Data JPA

首先配置 引入

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
配置database

 增加模块

增加model

 增加hibernate

首先新建文件 Hibernate.cfg.xml 在项目不重要位置

右键 hibernate 

之后就可以反向生成实体了

 

写public interface *****Repository extends JpaRepository<*****Entity,String> {}类 引入反向生成的实体类即可。


附:mybatis plus 反向生成用 idea使用插件mybatis-generator-plus生成mapper文件(mysql亲测可用)
 
talk is cheap. show me the code.
原文地址:https://www.cnblogs.com/yushizhang/p/13032144.html