For Spring Boot
3.1.1 working with Spring Data JPA
and others as follows:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
And taking in consideration the following tutorials and SO post respectively:
- Show Hibernate/JPA SQL Statements from Spring Boot
- Show SQL from Spring Data JPA/hibernate in Spring Boot
- How can I log SQL statements in Spring Boot?
Therefore having the application.properties
file as follows:
spring.profiles.active=h2
#spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.show_sql=true
#spring.jpa.properties.hibernate.format_sql=true
#spring.jpa.properties.hibernate.use_sql_comments=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
If is executed any of the following commands:
mvn spring-boot:run
mvn test -Dtest=com.manuel.jordan.service.crud.CienciaServiceCrudTests
In the terminal appears the SQL queries for all the CRUD methods as expected, therefore insert, update, delete etc ..., but does not appear the binding parameters as expected as the links (2nd and 3rd) have reported through their outputs. Therefore if is opened the dialog window to search, shift + ctrl + f on Ubuntu terminal, by using the search keys for either bind
and parameter
there are no coincidences.
Something special missing? or something to update? it about the Application Properties
Was tried with:
spring.profiles.active=h2
spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.show_sql=true
#spring.jpa.properties.hibernate.format_sql=true
#spring.jpa.properties.hibernate.use_sql_comments=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
and
spring.profiles.active=h2
#spring.jpa.show-sql=true
spring.jpa.properties.hibernate.show_sql=true
#spring.jpa.properties.hibernate.format_sql=true
#spring.jpa.properties.hibernate.use_sql_comments=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
and nothing
Just in case, it happens if the profile is changed from h2 to mysql