文章目录
JPA技术
Java Persistence Api(ORM 全自动化框架)
1. Springboot整合JPA
1.1 引入JPA
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
1.2配置
server:
port: 8099
#数据源配置
spring:
datasource:
druid:
url: jdbc:mysql://localhost:3306/mybatis_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: root
password: 1234
driver-class-name: com.mysql.cj.jdbc.Driver
#json时间处理
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
#jpa全自动框架
jpa:
hibernate:
ddl-auto: update
show-sql: true
logging:
level:
com.dyit.springboot