Springboot 集成 Ehcache操作数据库显示SQL语句设置
2023-09-13 23:33:35.030 INFO 6124 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-09-13 23:33:35.124 INFO 6124 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.20.Final
2023-09-13 23:33:35.137 WARN 6124 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-09-13 23:33:35.380 INFO 6124 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2023-09-13 23:33:35.572 INFO 6124 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
2023-09-13 23:33:35.621 WARN 6124 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2023-09-13 23:33:35.819 INFO 6124 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path '/ehcache'
2023-09-13 23:33:35.821 INFO 6124 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2023-09-13 23:33:36.410 INFO 6124 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-09-13 23:33:36.420 INFO 6124 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-09-13 23:33:36.670 INFO 6124 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2023-09-13 23:33:36.681 INFO 6124 --- [ main] org.bc.device.EhcacheApplication : Started EhcacheApplication in 6.344 seconds (JVM running for 7.048)
2023-09-13 23:33:42.253 INFO 6124 --- [nio-8081-exec-1] o.a.c.c.C.[.[localhost].[/ehcache] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-09-13 23:33:42.254 INFO 6124 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-09-13 23:33:42.264 INFO 6124 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms
2023-09-13 23:33:42.305 INFO 6124 --- [nio-8081-exec-1] o.b.d.controller.EmployeeController : findAll请求时间:2023-09-13T23:33:42.305664100
2023-09-13 23:33:42.310 INFO 6124 --- [nio-8081-exec-1] org.bc.device.config.EhcacheConfig : ehcache key str: org.bc.device.service.EmployeeService:findAll
2023-09-13 23:33:42.312 INFO 6124 --- [nio-8081-exec-1] org.bc.device.config.EhcacheConfig : ehcache key md5DigestAsHex: 363a29df59ef3a5e8c7fbae68bbdb213
2023-09-13 23:33:42.314 INFO 6124 --- [nio-8081-exec-1] org.bc.device.config.EhcacheConfig : ehcache key str: org.bc.device.service.EmployeeService:findAll
2023-09-13 23:33:42.314 INFO 6124 --- [nio-8081-exec-1] org.bc.device.config.EhcacheConfig : ehcache key md5DigestAsHex: 363a29df59ef3a5e8c7fbae68bbdb213
2023-09-13 23:33:42.323 INFO 6124 --- [nio-8081-exec-1] org.bc.device.service.EmployeeService : findAll查询数据库
Hibernate:
select
tbinfemplo0_.id as id1_0_,
tbinfemplo0_.age as age2_0_,
tbinfemplo0_.department as departme3_0_,
tbinfemplo0_.hire_date as hire_dat4_0_,
tbinfemplo0_.emp_name as emp_name5_0_,
tbinfemplo0_.salary as salary6_0_
from
tb_inf_employee tbinfemplo0_
2023-09-13 23:33:42.590 INFO 6124 --- [nio-8081-exec-1] o.b.d.controller.EmployeeController : findAll返回结果:[TbInfEmployee(id=1, name=1, age=1, salary=1.0, department=1, hireDate=2023-09-13), TbInfEmployee(id=2, name=1, age=1, salary=1.0, department=1, hireDate=2023-09-13), TbInfEmployee(id=3, name=1, age=1, salary=1.0, department=1, hireDate=2023-09-13), TbInfEmployee(id=4, name=1, age=1, salary=1.0, department=1, hireDate=2023-09-13), TbInfEmployee(id=5, name=1, age=1, salary=1.0, department=1, hireDate=2023-09-13), TbInfEmployee(id=6, name=1, age=1, salary=11.0, department=1, hireDate=2023-09-13)]
2023-09-13 23:33:42.613 INFO 6124 --- [nio-8081-exec-1] o.b.d.controller.EmployeeController : findAll返回时间:2023-09-13T23:33:42.613281300
server:
port: 8081
servlet:
context-path: /ehcache
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
username: root
password:
url: jdbc:mysql://127.0.0.1:3306/test_ehcache?characterEncoding=utf8&useUnicode=true&useSSL=false&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&failOverReadOnly=false&connectTimeout=6000&maxReconnects=5
initialSize: 5
minIdle: 5
maxActive: 20
cache:
type: ehcache
ehcache:
config: classpath:/ehcache.xml
jpa:
properties:
hibernate:
format_sql: true
show_sql: true
配置如下:
jpa:
properties:
hibernate:
format_sql: true
show_sql: true