1. Introduction of two dependencies
<Dependency> <groupId>Org.springframework.boot</groupId> <Artifactid>Spring-boot-starter-data-jpa</Artifactid></Dependency><Dependency> <groupId>Mysql</groupId> <Artifactid>Mysql-connector-java</Artifactid></Dependency>
2. Modify the data source configuration
Spring: Profiles: active:dev JPA: hibernate: ddl-auto:update show-sql:true DataSource: driver-class-name:com.mysql.jdbc.driver url:jdbc:mysql://127.0.0.1:3306/dbgirl Username:root PASSWORD:AAAAAA
3, the entity class has used three annotations @Entity @Id @GeneratedValue
4, Repository integrated JPA interface Org.springframework.data.jpa.repository. Jparepository
5, according to the other field query outside the primary key, expand the Query method, name the way findBy + field name
6, transaction processing. Use annotations @Transactional the method to implement the transaction.
Spring-boot database Operations (SPRING-DATA-JPA)