Re: Off-topic? How to extract database statements from JPA?

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Gus Spier <gus(dot)spier(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Off-topic? How to extract database statements from JPA?
Date: 2022-10-31 12:19:34
Message-ID: 1741106502.685747.1667218774177@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 31/10/2022 11:50 CET Gus Spier <gus(dot)spier(at)gmail(dot)com> wrote:
>
> I apologize if this is off-topic, but I've become exceedingly frustrated and
> need help.
>
> The assignment is to evaluate SQL code for an application that has been built
> with Java Springer Persistence API and, if appropriate, offer suggestions to
> improve database performance.
>
> The problem is that I am not a Java guy. I can usually read code and determine
> what it is trying to do. But here, I am at a loss. Where does the JPA hide the
> SQL code? I do not really expect a definitive, explicit answer, but if anybody
> could point me to documentation or a working aid that lays out where the JPA
> stores the DDL and DML, I would be truly grateful.

My JPA knowledge is a bit rusty and I only worked with Hibernate before.
Which JPA implementation do you use?

In case of Hibernate you can enable logging:

org.hibernate.SQL => DEBUG
org.hibernate.type.descriptor.sql => TRACE

If you also use Spring you can try the following config instead:

spring.jpa.show-sql = true
spring.jpa.properties.hibernate.format_sql = true

--
Erik

In response to

Browse pgsql-general by date

  From Date Subject
Next Message negora 2022-10-31 12:27:51 Re: Off-topic? How to extract database statements from JPA?
Previous Message Gus Spier 2022-10-31 10:50:42 Off-topic? How to extract database statements from JPA?