Springboot 集成 Ehcache操作数据库显示SQL语句设置

Springboot 集成 Ehcache操作数据库显示SQL语句设置

bash 复制代码
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
bash 复制代码
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

相关推荐
我是人✓16 分钟前
SpringBoot项目的五种创建方式
java·spring boot·后端
cspttty30 分钟前
2027用户研究求职准备:应用统计学如何补齐研究设计与业务表达
大数据·数据库
roman_日积跬步-终至千里2 小时前
【数据Agent论文·查询与语义|05】Spider:为什么换一个数据库,模型就不会查了?
数据库·数据分析
猫咪很可爱2 小时前
Oracle RAC 启动失败排查:私网通信与内核参数优化实战
运维·数据库·oracle
XLYcmy2 小时前
《数字经济赋能城市低碳治理的路径研究检索报告》审阅与修改指导意见——基于完整检索报告体例的完整性诊断、学术规范核查与方法论纠偏 上
数据库·ai·chatgpt·文心一言·检索·知网·豆包
泡海椒2 小时前
JQuick-SQL 快速开始:注册内存表并执行查询
数据库·windows·sql
ss2733 小时前
PG实战笔记 | 09 PostgreSQL psql客户端基本操作
数据库·笔记·postgresql
电商API_180079052473 小时前
反向海淘多币种结算:汇率该在哪个时点被冻结
java·开发语言·数据库·跨境电商·1688 api
古法老登瞎折腾3 小时前
大数据智能运维实战(一):机器和任务数据都有了,如何用 MCP 搭建运维助手?
大数据·运维·spring boot·spring ai·mcp
搞AI的金鱼3 小时前
skill agent workflow的区别
数据库