Hibernate SQL logging

When you turn on Hibernate’s SQL logging during Java development (e.g. log4j.logger.org.hibernate.SQL = debug, console), you won’t see values (only a ?) which will be/are used in a query.
e.g.

select this_.id as ID113_4_ ........ from INCOMINGMESSAGE ... where this_.STATUS=? and this_.FOO=?

Now turn on some extra logging (log4j.properties):

log4j.logger.org.hibernate.type = trace, console

Now you’ll see some extra information like the type (StringType / EnumType / etc.) and the value:

select this_.id as ID113_4_ ........ from INCOMINGMESSAGE ... where this_.STATUS=? and this_.FOO=?
DEBUG org.hibernate.type.EnumType  - Binding 'UNHANDLED' to parameter: 1
DEBUG org.hibernate.type.StringType  - Binding 'Bar' to parameter: 2

Note: When your application uses big queries then you’ll get a lot of extra logging\!