Tag Archives: beg dispel doubts!

Hibernate: How to get full sql query for session.save method?

I’m saving new object via Hibernate. What I would like to obtain is full sql query which was use. In debug Im getting query with “?” .

How to obtain same query with values.

K.

This is from my log4j configuration (Hibernate 3.6.8).

log4j.logger.org.hibernate.SQL = DEBUG, C

log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder = TRACE, C

log4j.appender.C = org.apache.log4j.ConsoleAppender

log4j.appender.C.layout = org.apache.log4j.PatternLayout

log4j.appender.C.layout.ConversionPattern = [%d{dd MMM yyyy HH:mm:ss,SSS}] %-5p %C.%M : %m%n

SQL has the logger for the SQL statement (you need to set it to DEBUG level) & BasicBinder the logger for the actual parameters (TRACE level)