mybatis-config.xml简单笔记

Posted 冲出地球

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis-config.xml简单笔记相关的知识,希望对你有一定的参考价值。

mybatis-config.xml简单笔记

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration   
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"   
    "http://mybatis.org/dtd/mybatis-3-config.dtd">  
<configuration>
    <settings>
        <setting name="cacheEnabled" value="true"/>
<!--          <setting name="enhancementEnabled" value="true"/> -->
<!--          <setting name="lazyLoadingEnabled" value="true"/> -->
<!--          <setting name="maxRequests" value="32"/> -->
<!--          <setting name="maxSessions" value="10"/> -->
<!--          <setting name="maxTransactions" value="5"/> -->
<!--          <setting name="useStatementNamespaces" value="true"/> -->
    
<!--        <setting name="lazyLoadingEnabled" value="true"/>-->
<!--        <setting name="aggressiveLazyLoading" value="false"/>-->
    </settings> 
     
   <typeAliases>  
        <typeAlias type="net.crm.user.model.UserAccount" alias="UserAccount" />  
        <typeAlias type="net.crm.sys.model.FilesInfo" alias="FilesInfo" />  
        <typeAlias type="net.crm.bill.model.BillFile" alias="BillFile" />  
         <typeAlias type="net.crm.salesmanage.model.CustomerInfo" alias="CustomerInfo" />
          <typeAlias type="net.crm.sys.model.Department" alias="Department" /> 
           <typeAlias type="net.crm.sys.model.WebjobLog" alias="WebjobLog" />  
           <typeAlias type="net.crm.salesmanage.model.EmployeeWork" alias="EmployeeWork" /> 
           <typeAlias type="net.crm.user.model.UserInfo" alias="UserInfo" /> 
    </typeAliases>  
     
     <!-- 别名
    <typeAliases>
          <typeAlias type="com.asgard.bms.business.model.Person" alias="PersonAlias"/>
      </typeAliases> 
       -->
      
      
      <!-- 
      指定数据库分页方言Dialect, 其它方言:OracleDialect,SQLServerDialect,SybaseDialect,DB2Dialect,PostgreSQLDialect,mysqlDialect,DerbyDialect 
   
    <plugins>  
        <plugin interceptor="com.asgard.cfap.plugin.dialect.interceptor.OffsetLimitInterceptor">  
            <property name="dialectClass" value="com.asgard.cfap.plugin.dialect.MySQLDialect"/>  
        </plugin>  
    </plugins> 
    
    <mappers>
        <mapper resource="com.asgard.bms.business.mapper.PersonMapper.xml"/>
    </mappers>
     -->
</configuration>

 

第二种

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration 
     PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
    
<configuration>
    <!-- 类型别名 -->
    <typeAliases>
        <typeAlias alias="User" type="com.jieyou.login_register.po.User" />
        <typeAlias alias="Admin" type="com.jieyou.login_register.po.Admin" />
    </typeAliases>
    
    <!-- 列出映射文件 -->
    <mappers>
        <mapper resource="com/jieyou/login_register/dao/mapping/UserMapper.xml" />
        <mapper resource="com/jieyou/login_register/dao/mapping/AdminMapper.xml" />
    </mappers>
</configuration>

 

以上是关于mybatis-config.xml简单笔记的主要内容,如果未能解决你的问题,请参考以下文章

Spring Boot简单xml配置集成mybatis

mybatis学习笔记

IDEA新建mybatis-config.xml配置文件

学习mybatis02---配置mybatis-config.xml文件

mybatis出现找不到mybatis-config.xml文件的问题

mybatis-配置文件mybatis-config.xml