title: hibernate how to show the criteria queries
body: <p>I think this is a simple question although I do not know how to solve it.</p>
  
  <p>In a spring/Hibernate application I need to show the query that a criteria execute.</p>
  
  <p>I know that I can use show_sql property and log the queries using log4j or any other logging framework but what I need is a higher level of logging.</p>
  
  <p>I have a method like this</p>
  
  <pre><code>public void searchIntegrationClient(IntegrationClientSearchCommand integrationClientSearchCommand,PartialList&lt;IntegrationClient&gt; partialList) {
      Session session = getSession();
      Criteria pageCriteria=session.createCriteria(IntegrationClient.class);
      if(StringUtil.isNotEmpty(integrationClientSearchCommand.getNameCmd())){
          pageCriteria.add(Restrictions.like("name", integrationClientSearchCommand.getNameCmd(), MatchMode.START));
      }
  
      //adding ordering alphabetically
      pageCriteria.addOrder(Order.asc("name"));
  
  
      pageCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
  
      List&lt;IntegrationClient&gt; list = (List&lt;IntegrationClient&gt;)pageCriteria.list();
      partialList.setPartialResultList(list);
      Criteria countCriteria=session.createCriteria(IntegrationClient.class);
      if(StringUtil.isNotEmpty(integrationClientSearchCommand.getNameCmd())){
          countCriteria.add(Restrictions.like("name", integrationClientSearchCommand.getNameCmd(), MatchMode.START));
      }
      countCriteria.setProjection(Projections.rowCount());
      partialList.setTotalNumberOfRecords(((Integer)countCriteria.uniqueResult()).intValue());
  
      releaseSession(session);
  }
  </code></pre>
  
  <p>I need before executes the criteria.list to show the query that will be executed?</p>
  
  <p>Is there any utility class in the criteria api to show the query like what I want ?</p>
  
  <p>Thnx in advance </p>