title: iBatis get executed sql
body: <p>Is there any way where I can get the executed query of iBatis? I want to reuse the query for an UNION query.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;sqlMap namespace="userSQLMap"&gt;
     &lt;select id="getUser" resultClass="UserPackage.User"&gt;
          SELECT username,
                 password 
          FROM table 
          WHERE id=#value#
     &lt;/select&gt;
  &lt;/sqlMap&gt;
  </code></pre>
  
  <p>And when I execute the query through</p>
  
  <pre><code>int id = 1
  List&lt;User&gt; userList = queryDAO.executeForObjectList("userSQLMap.getUser",id)
  </code></pre>
  
  <p>I want to get <code>SELECT username, password FROM table WHERE id=1</code></p>
  
  <p>Is there any way I could get the query? </p>
  
  <p>Thanks.</p>