mybatis官网参考文档-XML配置_映射器(mappers)(版本: 3.4.6-SNAPSHOT)
来源:互联网 发布:原生js 触发事件 编辑:程序博客网 时间:2024/05/16 17:48
XML 映射配置文件
映射器(mappers)
既然 MyBatis 的行为已经由上述元素配置完了,我们现在就要定义 SQL 映射语句了。但是首先我们需要告诉 MyBatis 到哪里去找到这些语句。 Java 在自动查找这方面没有提供一个很好的方法,所以最佳的方式是告诉 MyBatis 到哪里去找映射文件。你可以使用相对于类路径的资源引用, 或完全限定资源定位符(包括 file:/// 的 URL),或类名和包名等。例如:
<!-- Using classpath relative resources --><mappers> <mapper resource="org/mybatis/builder/AuthorMapper.xml"/> <mapper resource="org/mybatis/builder/BlogMapper.xml"/> <mapper resource="org/mybatis/builder/PostMapper.xml"/></mappers>
<!-- Using url fully qualified paths --><mappers> <mapper url="file:///var/mappers/AuthorMapper.xml"/> <mapper url="file:///var/mappers/BlogMapper.xml"/> <mapper url="file:///var/mappers/PostMapper.xml"/></mappers>
<!-- Using mapper interface classes --><mappers> <mapper class="org.mybatis.builder.AuthorMapper"/> <mapper class="org.mybatis.builder.BlogMapper"/> <mapper class="org.mybatis.builder.PostMapper"/></mappers>
<!-- Register all interfaces in a package as mappers --><mappers> <package name="org.mybatis.builder"/></mappers>
这些配置会告诉了 MyBatis 去哪里找映射文件,剩下的细节就应该是每个 SQL 映射文件了,也就是接下来我们要讨论的。
阅读全文
0 0
- mybatis官网参考文档-XML配置_映射器(mappers)(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_配置环境(environments)(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_对象工厂(objectFactory)(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_插件(plugins)(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_properties(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_settings(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_typeAliases(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_typeHandlers(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-XML配置_databaseIdProvider(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_自动映射(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-入门(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_select(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_参数(Parameters)(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_insert, update 和 delete(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_Result Maps(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-MapperXML_缓存(版本: 3.4.6-SNAPSHOT)
- mybatis官网参考文档-动态 SQL(版本: 3.4.6-SNAPSHOT)
- 05 Mybatis源码篇---XML配置之mappers 映射器
- 【16-20】LeetCode:Python解题
- 决策树算法 python实现
- 「Deep Learning」Instance Normalization
- Android Input Framework(三)---InputReader&InputDispatcher
- 修饰符权限
- mybatis官网参考文档-XML配置_映射器(mappers)(版本: 3.4.6-SNAPSHOT)
- LNMP环境安装包配置
- Jupyter Notebook 修改默认启动目录
- for of
- window.location.href 带参数跳转 如何获取值(解决)
- 科大讯飞语音开发包上手体验(2)
- 数论函数&狄利克雷卷积
- InputManagerService之事件的初始化与分发
- Writeup of Mountainclimbing(reverse) in BugKu