如何使用Play Framework显示SQL? [英] How do I show SQL with Play Framework?

查看:209
本文介绍了如何使用Play Framework显示SQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用数据库的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 中,也可以写在中的 hibernate.properties 文件中。 c> conf 您的Play应用程序的文件夹。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆