if I set
<property name="show_sql">true</property>
in my 休眠配置文件在控制台的配置文件中我可以看到SQL。
但事实并非如此realSQL...我可以查看将直接传递到数据库的 SQL 代码吗?
Example:
I see
select this_.code from true.employee this_ where this_.code=?
我可以看吗
select employee.code from employee where employee.code=12
the real SQL?
我能看到(...)真正的 SQL
如果您想查看直接发送到数据库的 SQL(即格式化similar对于您的示例),您必须使用某种 jdbc 驱动程序代理,例如P6Spy (or log4jdbc).
或者,您可以启用以下类别的日志记录(使用log4j.properties
文件在这里):
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type=TRACE
第一个相当于hibernate.show_sql=true
,第二个打印绑定参数等。
参考
- Hibernate 3.5 Core Documentation
- Hibernate 4.1 Core Documentation
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)