File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,47 @@ FROM City
266
266
]]> </source >
267
267
</subsection >
268
268
</section >
269
+ <section name =" User Defined Directives" >
270
+ <p >
271
+ mybatis-velocity allows you to write your own velocity directive:
272
+ </p >
273
+ <ul >
274
+ <li >
275
+ Create a property file named mybatis-velocity.properties and put in on the classpath.
276
+ </li >
277
+ <li >
278
+ Create your own velocity directive.
279
+ </li >
280
+ <li >
281
+ Add the directive to the property file.
282
+ </li >
283
+ <li >
284
+ Use the directive in the mapper xml file.
285
+ <br />
286
+ </li >
287
+ </ul >
288
+ <p >Example:</p >
289
+
290
+ <source ><![CDATA[
291
+ // User defined directive
292
+ package com.myproject.directives;
293
+
294
+ public class MyDirective extends Directive {
295
+
296
+ }
297
+
298
+ //mybatis-velocity.properties
299
+ userdirective=com.myproject.directives.MyDirective,com.myproject.directives.SpecialDirective;
300
+
301
+ // mapper xml file
302
+ SELECT *
303
+ FROM City
304
+ #myDirective()
305
+ ......
306
+ #end
307
+ ]]> </source >
308
+
309
+ </section >
269
310
<section name =" MyBatis specific syntax" >
270
311
<subsection name =" Parameter Bindings" >
271
312
<p >@{ property, attr1=val1, attr2=val2, ... }</p >
You can’t perform that action at this time.
0 commit comments