Search code examples
postgresqlspring-boothibernate

I can't see query variables on logging


I'm encountering issues with debugging SQL queries. I've attempted to configure the settings below to enable query debugging, but it hasn't been successful.

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.hibernate.type=TRACE

Here is my Hibernate output. As you can see there are no provided values corresponding to "token" and "is_active".

Hibernate:

select
    c1_0.id,
    c1_0.business_name,
    c1_0.is_active,
    c1_0.token 
from
    credential c1_0 
where
    c1_0.token=? 
    and c1_0.is_active

Furthermore, these configurations flawlessly on Java 11 and MySQL. However, I'm puzzled as to what might be causing issues with PostgreSQL 15 and Java 21.


Solution

  • I fixed the problem while replacing logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE with logging.level.org.hibernate.orm.jdbc.bind=TRACE

    And those were unnecessary

    logging.level.org.hibernate.SQL=DEBUG
    logging.level.org.hibernate.type=TRACE