title: MyBatis 3 - get SQL string from mapper
body: <p>I'd like to use MyBatis3 only to produce SQL string
  (using the xml mapping) but the SQL i obtain is not valid.</p>
  
  <p>Example, I obtain the sql string:</p>
  
  <pre><code>SELECT * FROM USER WHERE NAME = john
  </code></pre>
  
  <p>In this sql isn't present the <strong>'</strong> char sorrounding the string value <strong>john</strong></p>
  
  <p>in <strong>mybatis.xml</strong>:</p>
  
  <pre><code>...
      &lt;mappers&gt;
          &lt;mapper resource="sql1.xml"/&gt;
      &lt;/mappers&gt;
  ...
  </code></pre>
  
  <p><strong>sql1.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE mapper
  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  
     &lt;mapper namespace="sql1"&gt;
         &lt;select id="select1" parameterType="map" resultType="String" &gt;
             SELECT * FROM USERS
             WHERE 
             name LIKE ${name} AND num = ${number}
         &lt;/select&gt;
     &lt;/mapper&gt;
  </code></pre>
  
  <p>in <strong>MyBatisSql.java</strong>:</p>
  
  <pre><code>SqlSessionFactory sessionFactory = ConnectionFactory.getSqlSessionFactory();
  Configuration configuration = sessionFactory.getConfiguration();
  
  Map pars = new HashMap&lt;String, Object&gt;();
  pars.put("name", "john");    
  pars.put("number", 1345);
  
  MappedStatement ms = configuration.getMappedStatement("sql1.select1);   
  BoundSql boundSql = ms.getBoundSql(params);
  String sql = boundSql.getSql();
  System.out.println(sql);
  </code></pre>
  
  <p><strong>the result is</strong></p>
  
  <pre><code>SELECT * FROM USERS
  WHERE 
  name LIKE john AND num = 12345
  </code></pre>
  
  <p>in this SQL, the string <strong>john</strong>, isn't enclosed by the <strong>'</strong> char
  so it's not a valid SQL (my purpose is only to produce valid SQL string using myBatis). 
  I'd like to have:</p>
  
  <pre><code>SELECT * FROM USERS
  WHERE 
  name LIKE 'john' AND num = 12345
  </code></pre>
  
  <p>thanks</p>