SqlMapConfig.xml

 

1.1 介绍

SqlMapconfig.xmlmybatis的全局配置文件,mybatis通过它创建SqlSessionFactory

 

配置内容:

 

properties(属性)

settings(全局配置参数)

typeAliases(类型别名)

typeHandlers(类型处理器)

objectFactory(对象工厂)

plugins(插件)

environments(环境集合属性对象)

environment(环境子属性对象)

transactionManager(事务管理)

dataSource(数据源)

mappers(映射器)


属性

mybatis(五) SqlMapconfig.xml配置

settings

参考:mybatis-settings.xlsx

mybatis(五) SqlMapconfig.xml配置

mybatis(五) SqlMapconfig.xml配置

1.1 typeAliases(重点)

mybatis提供别名的定义,在mappe.xml中,指定输入参数类的全限定名不太方便,就可以定义一个别名代表参数类的全限定名。  

mybatis提供了很多别名:

别名

映射的类型

_byte

byte

_long

long

_short

short

_int

int

_integer

int

_double

double

_float

float

_boolean

boolean

string

String

byte

Byte

long

Long

short

Short

int

Integer

integer

Integer

double

Double

float

Float

boolean

Boolean

date

Date

decimal

BigDecimal

bigdecimal

BigDecimal


别名的定义: 

单个别名的定义

mybatis(五) SqlMapconfig.xml配置

使用别名:

mybatis(五) SqlMapconfig.xml配置


批量定义别名:

mybatis(五) SqlMapconfig.xml配置

mapper配置(重点)

mybatis(五) SqlMapconfig.xml配置




相关文章: