title: does MyBatis work inside Freemarker?
body: <p>I configured MyBatis to work with Freemarker like so:</p>
  
  <pre><code>    &lt;setting name="defaultScriptingLanguage" value="FreeMarker"/&gt;
  &lt;/settings&gt;
  &lt;typeAliases&gt;
      &lt;typeAlias type="org.mybatis.scripting.freemarker.FreeMarkerLanguageDriver" alias="FreeMarker"/&gt;
  &lt;/typeAliases&gt;
  </code></pre>
  
  <p>Then I have a select in MyBatis that I need to convert to Freemarker:</p>
  
  <pre><code>&lt;select id="find" parameterType="map" resultType="com.example.MyType"&gt;
      SELECT
          &lt;if test="_databaseId == 'sqlserver'"&gt;
              TOP (${r"#{rowLimit}"})
          &lt;/if&gt;
      FROM myexampletable
      &lt;choose&gt;
          &lt;when test="_databaseId == 'oracle'"&gt;
              WHERE rownum &amp;lt;= ${r"#{rowLimit}"}
          &lt;/when&gt;
          &lt;when test="_databaseId == 'postgresql' || _databaseId == 'h2'"&gt;
              LIMIT ${r"#{rowLimit}"}
          &lt;/when&gt;
      &lt;/choose&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>(The above code simplified for the sake of brevity.)</p>
  
  <p>The problem is this does not work at all, the MyBatis tags are ignored completely and all the TOP and LIMIT keywords appear in the same SQL command, no matter what DB dialect I use.</p>
  
  <p>I have to say it had worked perfectly fine, before I added Freemarker scripting. Is this a bug or a feature? Can I make both languages work in one script at the same time?</p>