onkami
onkami

Reputation: 9411

How to visualise SQL from Hibernate HQL (oracle)?

I have a complex database request made from some (historical) code using Hibernate towards Oracle 11, as a Named Query expressed in Hibernate Query Language aka HQL. This request is rather slow and I would like to get it fixed. But since Hibernate HQL operates with objects, it is problematic to understand how that is translated to SQL.

What would be the way to see actual SQL queries that are made for a given Named Query, using any feasible way (code/some software etc.)?

Upvotes: 0

Views: 373

Answers (1)

Adrián
Adrián

Reputation: 419

Please locate file 'hibernate.cfg.xml'. Then, try to locate/add property 'show_sql' and set it as 'true':

<property name="show_sql">true</property>

That should log your queries (without parameters).

Upvotes: 1

Related Questions