题
(看 这里 对于我试图解决的问题)
如何让 hibernate 记录它将要插入的 clob 值。它正在记录其他值类型,例如整数等。
我的 log4j 配置中有以下内容:
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
其产生的输出例如:
(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
但是您会注意到它永远不会显示 parameter: 3
这是我们的 clob。
我真正想要的是这样的:
(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
我如何让它在日志中显示这一点?
解决方案
尝试使用:
log4j.logger.net.sf.hibernate=DEBUG
log4j.logger.org.hibernate=DEBUG
这是您将获得的最好水平。如果它没有显示您想要的信息,那么这是不可能的。
其他提示
嗯,看来你不能。 (谢谢 马西奥 的建议,但遗憾的是没有添加任何有用的东西)
尝试设置 log4j.logger.org.hibernate.type=TRACE 并查看是否有帮助。
不隶属于 StackOverflow