1

How can I edit this piece of code used with hibernate 3 in order to corresponds to hibernate 5.6.1 version.

I see that Formatter is now an interface with one single method. enter image description here

andy
  • 61
  • 6

1 Answers1

0

For "basic SQL statements (DML + query)", please "try":

Formatter formatter = new org.hibernate.engine.jdbc.internal.BasicFormatterImpl();
formatter.format(query);

BasicFormatterImpl javadoc

For "DDL SQL statements", please:

Formatter formatter = org.hibernate.engine.jdbc.internal.DDLFormatterImpl.INSTANCE;
formatter.format(query);

DDLFormatterImpl javadoc

For "indent-/initialString" please consider a custom implementation, you can base on((/see source code of) the mentioned:

xerx593
  • 12,237
  • 5
  • 33
  • 64