java 如何使用 Play Framework 显示 SQL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4672863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I show SQL with Play Framework?
提问by mranders
I have a Play app that uses a database, and for debugging purposes I want to show the SQL that JPA uses. How can I do this?
我有一个使用数据库的 Play 应用程序,出于调试目的,我想显示 JPA 使用的 SQL。我怎样才能做到这一点?
回答by mranders
In application.conf
, you can turn showing SQL on uncommenting jpa.debugSQL=true
. This will give you the prepared statement queries with question marks in them. Also, Play uses Hibernate, so you can also use Hibernate properties. These can be written in application.conf
directly or in a separate hibernate.properties
file residing in the conf
folder of your Play application.
在 中application.conf
,您可以在取消注释时打开显示 SQL jpa.debugSQL=true
。这将为您提供带有问号的准备好的语句查询。此外,Play 使用 Hibernate,因此您也可以使用 Hibernate 属性。这些可以直接写入,也可以写入位于Play 应用程序文件夹application.conf
中的单独hibernate.properties
文件中conf
。
回答by opensas
maybe this could also help
也许这也有帮助
http://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-log4j/
http://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-log4j/
it allows you so also see the sql binding parameters values...
它使您还可以查看 sql 绑定参数值...