Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opTlX-0005Z4-Tn for pgsql-general@arkaria.postgresql.org; Mon, 31 Oct 2022 12:19:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1opTlW-00082N-RF for pgsql-general@arkaria.postgresql.org; Mon, 31 Oct 2022 12:19:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opTlW-00082B-GI for pgsql-general@lists.postgresql.org; Mon, 31 Oct 2022 12:19:42 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opTlU-0003KN-16 for pgsql-general@lists.postgresql.org; Mon, 31 Oct 2022 12:19:41 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4N1BzV4mxcz9sX0; Mon, 31 Oct 2022 13:19:34 +0100 (CET) Date: Mon, 31 Oct 2022 13:19:34 +0100 (CET) From: Erik Wienhold To: Gus Spier , pgsql-general Message-ID: <1741106502.685747.1667218774177@office.mailbox.org> In-Reply-To: References: Subject: Re: Off-topic? How to extract database statements from JPA? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4N1BzV4mxcz9sX0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 31/10/2022 11:50 CET Gus Spier wrote: > > I apologize if this is off-topic, but I've become exceedingly frustrated = and > need help. > > The assignment=C2=A0is to evaluate SQL code for an application that has b= een 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 dete= rmine > what it is trying to do. But here, I am at a loss. Where does the JPA hid= e the > SQL code? I do not really expect a definitive, explicit answer, but if an= ybody > 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: =09org.hibernate.SQL =3D> DEBUG =09org.hibernate.type.descriptor.sql =3D> TRACE If you also use Spring you can try the following config instead: =09spring.jpa.show-sql =3D true =09spring.jpa.properties.hibernate.format_sql =3D true -- Erik