bind

bind 元素允许你在 OGNL 表达式以外创建一个变量,并将其绑定到当前的上下文。比如:

  1. <select id="selectBlogsLike" resultType="Blog">
  2. <bind name="pattern" value="'%' + _parameter.getTitle() + '%'" />
  3. SELECT * FROM BLOG
  4. WHERE title LIKE #{pattern}
  5. </select>