野生的程序猿一只
2017-11-05 14:27
spring:
profiles:
active: dev
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/mybatis
username: root
password: 123456
jpa:
hibernate:
# ddl-auto: create
ddl-auto: update
show-sql: true
format-sql: true
use-sql-comments: true
https://stackoverflow.com/questions/25720396/how-to-set-hibernate-format-sql-in-spring-boot
spring.jpa.properties.hibernate.format_sql=true
可以,非常感谢
试试这个:
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.format_sql=true
或
spring: ... jpa: ... show-sql: true properties: hibernate.format_sql: true
或
spring: ... jpa: ... show-sql: true properties: hibernate: format_sql: true
以上均生效
注意 format_sql中间是下划线,连字符的写法format-sql不生效
Console输出结果
2018-02-01 13:23:49.965 INFO 1905 --- [nio-8080-exec-2] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
Hibernate:
select
girl0_.id as id1_0_,
girl0_.age as age2_0_,
girl0_.cup_size as cup_size3_0_
from
girl girl0_
format_sql: true 起作用
format-sql: true 不起作用其他都能行
这里的配置不起作用,配置到hibernate属性下面也不起作用,中间的短线变成下划线也不起作用,求解
Spring Boot进阶之Web进阶
104040 学习 · 393 问题
相似问题