0

I am trying to print the query for logging purpose, I tried using ObjectMapper to convert org.hibernate.query.criteria.internal.Criteria object into String but getting serialisation error. Any suggestion would be helpful..

Thanks

Azhar
  • 1
  • 1
  • Does this answer your question? [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) – XtremeBaumer Jun 10 '22 at 14:45

1 Answers1

0

If you just want to convert the object to String , you can try GSON. You have to install the Gson jar first after that

String query = new Gson().toJson(hibernate_object);

Rayan
  • 1
  • This answer makes no sense. He's trying to print the query used by the underline ORM. Apparently the toString does not print this. There is no JSON involved here at all – Chris Maggiulli Jun 11 '22 at 06:34