Getting hibernate to log clob parameters

Posted by SCdF on Stack Overflow See other posts from Stack Overflow or by SCdF
Published on 2008-09-10T03:19:38Z Indexed on 2010/06/15 14:32 UTC
Read the original article Hit count: 286

Filed under:
|
|

(see here for the problem I'm trying to solve)

How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc.

I have the following in my log4j config:

log4j.logger.net.sf.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.net.sf.hibernate.type=DEBUG
log4j.logger.org.hibernate.type=DEBUG

Which produces output such as:

(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2

However you'll note that it never displays parameter: 3 which is our clob.

What I would really want is something like:

(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '0' to parameter: 2
(org.hibernate.type.ClobType) binding 'something' to parameter: 3
(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?)
(org.hibernate.type.LongType) binding '170650' to parameter: 1
(org.hibernate.type.IntegerType) binding '1' to parameter: 2
(org.hibernate.type.ClobType) binding 'something else' to parameter: 3

How do I get it to show this in the log?

© Stack Overflow or respective owner

Related posts about java

Related posts about Oracle