我是靠谱客的博主 朴素服饰,这篇文章主要介绍SpringBoot集成JPA,控制台输出SQL语句,现在分享给大家,希望可以做个参考。

在写项目时用到了JPA,想看SQL输出,发现使用logging.level.xxx.xxx.dao=debug 不好使,在这里记录一下:

在application.yml中添加:

jpa:
show-sql: true
properties:
hibernate:
format_sql: true
#格式化SQL,如果不加,SQL输出不换行,不方便查看

在application.properties中添加:

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

 

最后

以上就是朴素服饰最近收集整理的关于SpringBoot集成JPA,控制台输出SQL语句的全部内容,更多相关SpringBoot集成JPA内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(134)

评论列表共有 0 条评论

立即
投稿
返回
顶部