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

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: Off-topic? How to extract database statements from JPA?
Дата
Msg-id 1741106502.685747.1667218774177@office.mailbox.org
обсуждение исходный текст
Ответ на Off-topic? How to extract database statements from JPA?  (Gus Spier <gus.spier@gmail.com>)
Список pgsql-general
> 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Gus Spier
Дата:
Сообщение: Off-topic? How to extract database statements from JPA?
Следующее
От: negora
Дата:
Сообщение: Re: Off-topic? How to extract database statements from JPA?