pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Gus Spier <gus.spier@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Off-topic? How to extract database statements from JPA?
Date: Mon, 31 Oct 2022 13:19:34 +0100 (CET)
Message-ID: <1741106502.685747.1667218774177@office.mailbox.org> (raw)
In-Reply-To: <CAG8xnieB=8GCC5ssitW81bGHJ_4xGz=iC663h-1Qj5ViXqn+Dw@mail.gmail.com>
References: <CAG8xnieB=8GCC5ssitW81bGHJ_4xGz=iC663h-1Qj5ViXqn+Dw@mail.gmail.com>

> On 31/10/2022 11:50 CET Gus Spier <gus.spier@gmail.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





view thread (3+ messages)  latest in thread

Message-ID: <1741106502.685747.1667218774177@office.mailbox.org>
Permalink:  ../1741106502.685747.1667218774177@office.mailbox.org/
Also on:    postgresql.org/message-id/1741106502.685747.1667218774177@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ewie@ewie.name, gus.spier@gmail.com
  Subject: Re: Off-topic? How to extract database statements from JPA?
  In-Reply-To: <1741106502.685747.1667218774177@office.mailbox.org>
  References: <CAG8xnieB=8GCC5ssitW81bGHJ_4xGz=iC663h-1Qj5ViXqn+Dw@mail.gmail.com> <1741106502.685747.1667218774177@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox