网站大量收购独家精品文档,联系QQ:2885784924

ibatis配置文件语法.DOC

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ibatis配置文件 [color=darkred][/color]最近在用ibatis,想看看他的xml文件中都定义了哪些属性,于是去下了个sql-map-2.dtd和sql-map-config-2.dtd文件。 SqlMapConfig.xml文件用的是sql-map-config-2.dtd 映射文件用的是sql-map-2.dtd SqlMapConfig.xml文件没有什么好看的,都是一般的数据库配置等。 sql-map-config-2.dtd值得研究下。 我感兴趣的是如下属性: include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable 这些在我们组建sql的时候很有用,如在where后组装sql isNotEmpty property=name isEqual property=isNameLike compareValue=on AND t3.name like $name$% /isEqual isNotEqual property=isNameLike compareValue=on AND t3.name= #name# /isNotEqual /isNotEmpty dtd文件中还有注释和例子,真是学习的好东西。 include: Example: sql id=selectItem_fragment FROM items WHERE parentid = 6 /sql select id=selectItemCount resultClass=int SELECT COUNT(*) AS total /select select id=selectItems resultClass=Item SELECT id, name include refid=selectItem_fragment/ /select iterate: Iterates over a property that is an implementation java.util.Collection, or java.util.Iterator, or is an array. Example Usage: iterate prepend=”AND” property=”userNameList” open=”(” close=”)” conjunction=”OR” username=#userNameList[]# /iterate It is also possible to use the iterate when the collection is passed in as a parameter to your mapped statement. Example Usage: iterate prepend=”AND” open=”(” close=”)” conjunction=”OR” username=#[]# /iterate Note: It is very important to include the square brackets[] at the end of the property name when using the Iterate element. These brackets distinguish this object as a collection to keep the parser from simply outputting the collection as a string. 很简单的E文。开发时有dtd文档做参考其实就够了,不用google了。 ----------------------------------------------------------------- 在ibatis中使用安全的拼接语句,动态查询 ibatis比JDBC的优势之一,安全高效 说明文字在注释中 select id=selectAllProducts parameterClass=Product resultMap=ProductResult select id,

文档评论(0)

153****9595 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档