Mapper XML files contain the mapped SQL statements that will be executed by the application using statement id. We need to configure the locations of the SQL Mapper files in mybatis-config.xml.

<mappers>
<mapper resource="com/mybatis3/mappers/StudentMapper.xml"/>
<mapper url="file:///D:/mybatisdemo/app/mappers/TutorMapper.xml"/>
<mapper class="com.mybatis3.mappers.TutorMapper"/>
<package name="com.mybatis3.mappers"/>
</mappers>

Each of the <mapper> tag attributes facilitates to load mappers from different kinds of sources:

  • The attribute resource can be used to point to a mapper file that is in the classpath
  • The attribute url can be used to point to a mapper file by its fully qualified filesystem path or web URL
  • The attribute class can be used to point to a Mapper interface
  • The package element can be used to point to a package name where Mapperinterfaces can be found

MyBatis(3.2.3) - Configuring MyBatis using XML, Mappers的更多相关文章

  1. MyBatis(3.2.3) - Configuring MyBatis using XML, Environment

    The key component of MyBatis is SqlSessionFactory from which we get SqlSession and execute the mappe ...

  2. MyBatis(3.2.3) - Configuring MyBatis using XML, typeHandlers

    As discussed in the previous chapter, MyBatis simplifies the persistent logic implementation by abst ...

  3. MyBatis(3.2.3) - Configuring MyBatis using XML, typeAliases

    In the SQL Mapper configuration file, we need to give the fully qualified name of the JavaBeans for ...

  4. MyBatis(3.2.3) - Configuring MyBatis using XML, Settings

    The default MyBatis global settings, which can be overridden to better suit application-specific nee ...

  5. MyBatis(3.2.3) - Configuring MyBatis using XML, Properties

    The properties configuration element can be used to externalize the configuration values into a prop ...

  6. Mybatis增加对象属性不增加mapper.xml的情况

    Mybatis增加对象属性不增加mapper.xml的情况: 只增加Model 对象的属性,在查询语句中返回相同名称的字段,但是在mapper中的 resultMap上面不进行新增字段的增加,查询结果 ...

  7. Mybatis之旅第三篇-SqlMapConfig.xml全局配置文件解析

    一.前言 刚换工作,为了更快的学习框架和了解业务,基本每天都会加班,导致隔了几天没有进行总结,心里总觉得不安,工作年限越长越感到学习的重要性,坚持下去!!! 经过前两篇的总结,已经基本掌握了mybat ...

  8. Mybatis学习总结(三)——SqlMapConfig.xml全局配置文件解析

    经过上两篇博文的总结,对mybatis中的dao开发方法和流程基本掌握了,这一节主要来总结一下mybatis中的全局配置文件SqlMapConfig.xml在开发中的一些常用配置,首先看一下该全局配置 ...

  9. Java Persistence with MyBatis 3(中文版) 第三章 使用XML配置SQL映射器

    关系型数据库和SQL是经受时间考验和验证的数据存储机制.和其他的ORM 框架如Hibernate不同,MyBatis鼓励开发者可以直接使用数据库,而不是将其对开发者隐藏,因为这样可以充分发挥数据库服务 ...

随机推荐

  1. codeforces 337D 树形DP Book of Evil

    原题直通车:codeforces 337D Book of Evil 题意:一棵n个结点的树上可能存在一个Evil,Evil危险范围为d,即当某个点与它的距离x<=d时,那么x是危险的. 现已知 ...

  2. windows下实现微秒级的延时

    windowsintegeriostream汇编嵌入式任务 最近正在做一个嵌入式系统,是基于windows ce的,外接硬件的时序要微秒级的延时.1.微秒级的延时肯定不能基于消息(SetTimer函数 ...

  3. map的两种取值方式

    public class MapUtil{ public static void iteratorMap1(Map m) { Set set=m.keySet();//用接口实例接口 Iterator ...

  4. Codeforces Round #328 (Div. 2) A. PawnChess 暴力

    A. PawnChess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/ ...

  5. CDOJ 482 Charitable Exchange bfs

    Charitable Exchange Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/s ...

  6. StarlingMVC简介,原理解说及示例源码

    StarlingMVC简介 StarlingMVC是一个为使用Starling来开发游戏的MVC框架.这个框架的特性方面,很像Swiz和RobotLegs,原理亦像Mate.其特性列表如下: 依赖注入 ...

  7. 15分钟学会git基本的操作命令

    http://hao.jobbole.com/try-git/ 假如你现在新创建了一个项目,想把它提交到github上面? 假设你创建好了一个项目,并切换到项目的根目录下面: $ git status ...

  8. 【ZZ】Python入门神图

    http://mp.weixin.qq.com/s?__biz=MzA3OTIxNTA0MA==&mid=401383338&idx=1&sn=73009cce06d58656 ...

  9. 关于Service常驻内存不被清理的解决方法.

    众所周知, Service是跑后台的. 但是有些Rom厂商把一键清理做的真是太好用了, 以至于一键清理变成了一种习惯, Service已经变的不再是Service了. 那为什么像诸如360, 微信, ...

  10. php中常用设置

    设置SESSION的生命周期 今天我所要想解决的问题,简单来说,就是设置SESSION的生命周期问题,其实问题是很简单了,只是不知道为什么,我用session_cache_expire(12*60); ...