title: How to get fully materialized query from querydsl
body: <p>I am trying to use querydsl for building dynamic queries for dynamic schemas. I am trying to get just the query instead of having to actually execute it.</p>
  
  <p>So far I have faced two issues:
  - The schema.table notation is absent. Instead I only get the table name.
  - I have been able to get the query but it separates out the variables and puts '?' instead which is understandable. But I am wondering if there is some way to get fully materialized query including the parameters.</p>
  
  <p>Here is my current attempt and result(I am using MySQLTemplates to create the configuration):</p>
  
  <pre><code>private SQLTemplates templates = new MySQLTemplates();
  private Configuration configuration = new Configuration(templates); 
  
  String table = "sometable"
  Path&lt;Object&gt; userPath = new PathImpl&lt;Object&gt;(Object.class, table);
  StringPath usernamePath = Expressions.stringPath(userPath, "username");
  NumberPath&lt;Long&gt; idPath = Expressions.numberPath(Long.class, userPath, "id");
  SQLQuery sqlQuery = new SQLQuery(connection, configuration)
    .from(userPath).where(idPath.eq(1l)).limit(10);
  String query = sqlQuery.getSQL(usernamePath).getSQL();
  return query;
  </code></pre>
  
  <p>And what I get is:</p>
  
  <pre><code>select sometable.username
  from sometable
  where sometable.id = ?
  limit ?
  </code></pre>
  
  <p>What I wanted to get was:</p>
  
  <pre><code>select sometable.username
  from someschema.sometable
  where sometable.id = ?
  limit ?
  </code></pre>
  
  <p><em>Update:</em> I came up with this sort of <strong>hack to get parameters materialized</strong>(Not ideal and would love better solution) But still <strong>could not get Schema.Table notation to work</strong>:</p>
  
  <p>Hack follows. Please suggest cleaner QueryDsl way of doing it:</p>
  
  <pre><code>String query = cleanQuery(sqlQuery.getSQL(usernamePath));
  
  private String cleanQuery(SQLBindings bindings){
      String query = bindings.getSQL();
      for (Object binding : bindings.getBindings()) {
          query = query.replaceFirst("\\?", binding.toString());
      }
      return query;
  }
  </code></pre>