I
I
Igor Petrov2012-06-20 22:31:17
Java
Igor Petrov, 2012-06-20 22:31:17

How to tell Hibernate to show what it substitutes instead of '?'

Hello!

Purely for debugging purposes, you need to see what kind of requests does the hibernate make?
I already have such properties:
<property name="show_sql">true</property> <property name="format_sql">true</property> <property name="use_sql_comments">true</property>

But I have the following conclusion:
update table1 set field1=?, field2=?, field3=?, fk_table1_id=?, fk_table2_id=?
Here, in fact, I would like to see what is behind the signs "?".

I will be very grateful!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
gvsmirnov, 2012-06-20
@gvsmirnov

Enable debug logs, then it will be shown as binding 'value' to parameter: 1.
PS In general, it is much better to use not question marks, but named parameters ( update table1 set field1=:field1, field2=:field2 ...). It may seem redundant at first, but it's harder to shoot in the leg and can be reused.

E
eugenius_nsk, 2012-06-22
@eugenius_nsk

You need to set up logging by including org.hibernate.type at the trace level. For log4j this is done like this: log4j.logger.org.hibernate.type=trace

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question