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?
STEP 1: Allocate a Connection object, for connecting to the database server. STEP 2: Allocate a Statement object, under the Connection created earlier, for holding a SQL command. STEP 3: Write a SQL query and execute the query, via the Statement and Connection created. STEP 4: Process the query result.
Enter the SQL command you want to run in the command editor. Click Run (Ctrl+Enter) to execute the command. Tip: To execute a specific statement, select the statement you want to run and click Run.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With