tags:

views:

78

answers:

3

this is example of how sql is showed when using show_sql=true

Hibernate:
    select
        propertyse0_.entity_name as entity1_3_0_,
        propertyse0_.entity_id as entity2_3_0_,
        propertyse0_.entity_key as entity3_3_0_,
        propertyse0_.key_type as key4_3_0_,
        propertyse0_.boolean_val as boolean5_3_0_,
        propertyse0_.double_val as double6_3_0_,
        propertyse0_.string_val as string7_3_0_,
        propertyse0_.long_val as long8_3_0_,
        propertyse0_.int_val as int9_3_0_,
        propertyse0_.date_val as date10_3_0_
    from
        OS_PROPERTYENTRY propertyse0_
    where
        propertyse0_.entity_name=?
        and propertyse0_.entity_id=?
        and propertyse0_.entity_key=?

possible to show value to gather with the sql rather than '?'

A: 

not directly. you can use log4jdbc to log all the data that is sent over jdbc. It has a logger that inlines the prepared statement values.

bertolami
can elaborate more how to integrate with spring+hibernate existing app
cometta
I created a proxy for my datasource in spring that added the logger spy of log4jdbc. And I have to admit that this is not done in 10 minutes. However, for my purpose it was worth the effort. But I just included it for my tests and not in the app server.
bertolami
+1  A: 

You need to set up your logging framework to log this level of details. See here for the various loggers that Hibernate uses, and how to use them.

The particular one that you want is:

  • org.hibernate.type - Log all JDBC parameters
skaffman
A: 

Set your logging leven to "TRACE". In your log4j.properties (assuming your using Log4J):

log4j.logger.org.hibernate=TRACE

Will result in lots of logging tough...

EJB