Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set hibernate.format_sql in spring-boot?

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?

like image 647
membersound Avatar asked Sep 08 '14 08:09

membersound


People also ask

What is Format_sql in Hibernate?

Format the generated SQL statement to make it more readable, but takes up more screen space. 🙂 <!-- hibernate.cfg.xml --> <property name="format_sql">true</property> Output.

How do I enable SQL logging in Hibernate?

Activating Logging in Hibernate To activate the logging of the executed SQL statements with Spring Boot, set the log level of the org. hibernate. SQL category to DEBUG . If you wish to see the bind values, you can set the log level of org.


1 Answers

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

like image 103
geoand Avatar answered Oct 01 '22 09:10

geoand