title: How to get SQL Query with parameter values from TypedQuery?
body: <p>I would like to know if it is possible to retrieve the <strong>(Native) SQL Query, with parameter values</strong>, from a TypedQuery. The code would be something like:</p>
  <pre><code>public String getNativeSQLString(){
      CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
      CriteriaQuery&lt;Foo&gt; criteriaQuery = criteriaBuilder.createQuery(Foo.class);
      Root&lt;Foo&gt; root = criteriaQuery.from(Foo);
  
      criteriaQuery.select(root);
      criteriaQuery.where(getPredicatesArray());
      TypedQuery&lt;GhSummary&gt; typedQuery = entityManager.createQuery(criteriaQuery);
  
      // magic to transform typedQuery to Native SQL
  
      return nativeSql;
  }
  </code></pre>
  <p>An example of return would be: <code>&quot;SELECT * FROM foo WHERE id = 2 AND name IN ('name1', 'name2') ORDER BY name DESC&quot;</code>.</p>
  <p>I'm aware that using <code>String sqlQueryString = new BasicFormatterImpl().format(typedQuery.unwrap(Query.class).getQueryString());</code> I'm able to retrieve the HQL <code>SELECT * FROM foo WHERE id =:param0 AND name IN (:param1, :param2) ORDER BY name DESC</code>, but it does not contain the values.</p>
  <p>Thanks in advance.</p>