title: How to get SQL from Hibernate Criteria API (*not* for logging)
body: <p>Is there a way to get the (to-be-generated) SQL from a Hibernate <code>Criteria</code>?</p>
  
  <p>Ideally, I would have something like:</p>
  
  <pre><code>Criteria criteria = session.createCriteria(Operator.class);
  
  ... build up the criteria ...
  ... and then do something like ...
  
  String sql = criteria.toSql()
  
  (But this of course does not exist)
  </code></pre>
  
  <p>The idea would then be to use the SQL as part of a huge 'MINUS' query (I need to find the differences between 2 identical schemas - identical in structure, not in data - and the MINUS is not supported by Hibernate)</p>
  
  <p>(BTW I know I can check the SQL from the log files)</p>