如何使用Play Framework显示SQL? [英] How do I show SQL with Play Framework?
问题描述
我有一个使用数据库的Play应用程序,出于调试目的,我想显示JPA使用的SQL。我该怎么做?
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?
推荐答案
在 application.conf
中,你可以在取消注释 jpa.debugSQL = true
时显示SQL。这将为您提供带有问号的预准备语句查询。另外,Play使用Hibernate,因此您也可以使用Hibernate属性。这些可以直接写在 application.conf
中,也可以写在中的
您的Play应用程序的文件夹。 hibernate.properties
文件中。 c> conf
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.
这篇关于如何使用Play Framework显示SQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!