Example usage for org.hibernate.engine.jdbc.internal BasicFormatterImpl format

List of usage examples for org.hibernate.engine.jdbc.internal BasicFormatterImpl format

Introduction

In this page you can find the example usage for org.hibernate.engine.jdbc.internal BasicFormatterImpl format.

Prototype

@Override
    public String format(String source) 

Source Link

Usage

From source file:be.shad.tsqb.hql.HqlQuery.java

License:Apache License

/**
 * String with newlines and spaces to outline the query in a pretty format.
 *///from   ww w .  j ava2s.co  m
public String toFormattedString() {
    BasicFormatterImpl formatter = new BasicFormatterImpl();
    String prettyHql = formatter.format(getHql());
    prettyHql = prettyHql.replaceAll("((from|join|select|where)\\n\\s*)", "$2 ");
    return prettyHql + "\n --- with: " + params.toString().replace("PARAM [", "\n[");
}