I'm using spring-boot
autoconfiguration for database injection, with properties defined:
spring.jpa.database=POSTGRESQL
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
But how can I set the hibernate.format_sql=true
? Is that not supported by spring boot?
Spring Boot will let you set any available hibernate property using:
spring.jpa.properties.*
So spring.jpa.properties.hibernate.format_sql=true
would work as well.
Check out this part of the documentation
You can use : spring.jpa.properties.hibernate.format_sql=true
Apart from the documentation , I do follow example from here to configure my application. You can find a sample of properties being used in that.
这非常有用
spring.jpa.hibernate.format_sql=true
If you are using yml
format to declare Spring Boot properties, you can use:
spring:
datasource:
jpa:
properties:
hibernate.format_sql: true
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate.format_sql: true
Follow this below properties
spring.jpa.properties.hibernate.format_sql=true
#Turn Statics On
spring.jpa.properties.hibernate.generate_statistics=true
logging.level.org.hibernate.stat=debug
#Show all queries
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.type=trace
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.