How do I show SQL with Play Framework?

2019-02-05 15:30发布

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?

2条回答
Juvenile、少年°
2楼-- · 2019-02-05 16:34

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.

查看更多
萌系小妹纸
3楼-- · 2019-02-05 16:34

maybe this could also help

http://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-log4j/

it allows you so also see the sql binding parameters values...

查看更多
登录 后发表回答