Hibernate: show-sql is for demos; use the logger in real life

The logger includes parameters and can be filtered per package; show-sql just prints to stdout.

Code
// application.yml
logging:
  level:
    org.hibernate.SQL: DEBUG
    org.hibernate.orm.jdbc.bind: TRACE     # parameter values (Hibernate 6)

# Rather than:
spring.jpa.show-sql: true
Output
DEBUG org.hibernate.SQL - select o1_0.id ... from orders o1_0 where o1_0.status=?
TRACE binding parameter (1:VARCHAR) <- [PLACED]
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-11