1.需求
1.1在编写mapper.xml的时候parameterType和resultType总是需要类的全限定名称,故而mybatis提供了一种定义类型别名的方法。
2.实现
2.1定义pojo类的别名--基于mybatis配置文件的实现
<typeAliases>
<!-- 为单个类型定义别名 -->
<typeAlias type="com.ssm.model.User" alias="user"/>
<!-- 批量定义别名 别名为类名 首字母大小写均可-->
<package name="com.ssm.model"/>
</typeAliases>
2.2定义pojo类的别名--基于注解的实现
@Alias("user")
class User{}
2.3mybatis已定义的类型与java类型对应
/**
_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
object Object
map Map
hashmap HashMap
list List
arraylist ArrayList
collection Collection
iterator Iterator
**/