Skip to content

Commit a32cb34

Browse files
committed
Some more info about using different languages by default and a note
that points to Velocity
1 parent f2196bf commit a32cb34

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/site/es/xdoc/dynamic-sql.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ AND title like ‘someTitle’]]></source>
196196
<p>El lenguaje <code>raw</code> es en realidad la ausencia de lenguaje. Con esta configuración MyBatis sólo realiza la sustitución de parámetros
197197
y pasa la sentencia al driver de base de datos. Como supondrás el lenguaje <code>raw</code> es más rápido que el <code>xml</code>.
198198
</p>
199-
<p>Puedes indicar el lenguaje que quieres usar en cada statement añadiendo el atributo <code>lang</code> de la siguiente forma:
199+
<p>Puedes indicar le lenguaje por defecto para tu proyecto configurandolo en el fichero mybatis-config.xml:</p>
200+
<source><![CDATA[<settings>
201+
<setting name="defaultScriptingLanguage" value="raw"/>
202+
</settings>
203+
]]></source>
204+
<p>Puedes indicar el lenguaje que quieres usar en un statement específico añadiendo el atributo <code>lang</code> de la siguiente forma:
200205
</p>
201206
<source><![CDATA[<select id="selectBlog" lang="raw">
202207
SELECT * FROM BLOG
@@ -207,6 +212,9 @@ AND title like ‘someTitle’]]></source>
207212
@Select("SELECT * FROM BLOG")
208213
List<Blog> selectBlog();
209214
}]]></source>
215+
216+
<p><span class="label important">NOTA</span> Puedes utilizar Apache Velocity como lenguaje dinámico. Echa un vistazo al proyecto MyBatis-Velocity para conocer los detalles.</p>
217+
210218
<p>También puedes implementar tu propio lenguaje implementado el siguiente interfaz:</p>
211219
<source><![CDATA[public interface LanguageDriver {
212220
ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql);

src/site/xdoc/dynamic-sql.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ AND title like ‘someTitle’]]></source>
196196
parameter substitution and passes the statement to the database driver. As you may guess, the <code>raw</code> language
197197
is faster than the <code>xml</code> language.
198198
</p>
199-
<p>You can specify the language you want to use in an statement adding the <code>lang</code> attribute as follows:
199+
<p>You can change the default language for your project by configuring it in the mybatis-config.xml file:</p>
200+
<source><![CDATA[<settings>
201+
<setting name="defaultScriptingLanguage" value="raw"/>
202+
</settings>
203+
]]></source>
204+
<p>You can also specify the language you want to use in an specific statement by adding the <code>lang</code> attribute as follows:
200205
</p>
201206
<source><![CDATA[<select id="selectBlog" lang="raw">
202207
SELECT * FROM BLOG
@@ -207,6 +212,9 @@ AND title like ‘someTitle’]]></source>
207212
@Select("SELECT * FROM BLOG")
208213
List<Blog> selectBlog();
209214
}]]></source>
215+
216+
<p><span class="label important">NOTE</span> You can use Apache Velocity as your dynamic language. Have a look at the MyBatis-Velocity project for the details.</p>
217+
210218
<p>You can also implement your own language driver by implementing the following interface:</p>
211219
<source><![CDATA[public interface LanguageDriver {
212220
ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql);

src/site/xdoc/logging.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n]]></source>
185185
<source>log4j.logger.org.mybatis.example=TRACE</source>
186186

187187
<p>There are queries that can return huge result sets. In that cases you may want to see the
188-
SQL statement but not the results. For that purpose SQL statements are logged with DEBUG level
189-
(FINE in JDK logging) and results with TRACE level (FINER in JDK logging), so in case
188+
SQL statement but not the results. For that purpose SQL statements are logged at the DEBUG level
189+
(FINE in JDK logging) and results at the TRACE level (FINER in JDK logging), so in case
190190
you want to see the statement but not the result, set the level to DEBUG.
191191
</p>
192192

0 commit comments

Comments
 (0)