1

My question is very general, When Hibernate logging is set to true, we can see what Hibernate writes inside the console as some sort of Hibernate SQL language.

Is it possible to translate this, or even get it in the console as regular SQL code? So it would say something like INSERT product('name', 'price') WHERE.. etc..

Instead of the Hibernate language we currently see. Thanks in advance!

EDIT: To clarify, I would like to copy what Hibernate writes in my console, and be able to paste it into my SQL Workbench and insert it as an SQL command. (IF this is possible that is.) Thanks!

  • 1
    Possible duplicate of [How to print a query string with parameter values when using Hibernate](https://stackoverflow.com/questions/1710476/how-to-print-a-query-string-with-parameter-values-when-using-hibernate) – Alan Hay May 22 '19 at 09:20
  • 1
    SQL logging with params bound: https://stackoverflow.com/a/19299769/1356423 – Alan Hay May 22 '19 at 09:21
  • This only allows for us to see it in an SQL way? But is it possible to see it in a way so I could copy the entire statement over to a SQL file and use it inside of my workbench? – harrigaturu May 23 '19 at 07:05
  • The answer referred to in my 2nd comment outputs the actual SQLstatements executed by Hibernate to the console or file depending on your logging set up. I'm not sure exactly what else you would need. – Alan Hay May 23 '19 at 07:07
  • It logs like this for me: */ insert into question (mandatory, position, question_type, title) values (?, ?, ?, ?) WIth the values being printed above it, it's not possible to have it not do the questionmarks at all and instead show the values inserted? – harrigaturu May 23 '19 at 07:16
  • As I have pointed out - **TWICE** - I have given an answer here - stackoverflow.com/a/19299769/1356423 - that will log the SQL **with the parameters in place**. – Alan Hay May 23 '19 at 08:22

0 Answers0