typeAliases is set to reduce the length of class names.
For example:
<typeAliases>
<typeAlias type="net.mybatis.model.User" alias="User"/>
</typeAliases>
The above-mentioned later use of net.mybatis.model.User can be replaced by User. The basis of these is only available in configuration files.
Of course, it can also be done in the form of scanning packages:
<typeAliases>
<package name="net.mybatis.model"/>
</typeAliases>
In addition, it can also be done in the form of declarations, such as:
package net.mybatis.model;
import org.apache.ibatis.type.Alias;
@Alias("User")
public class User {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
return this.getClass().getName()+":[name:"+this.name+"]";
}
}
These can be understood as an alias.
Below are the aliases for the system.
Alliance |
Type |
_byte |
btye |
_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 |
date |
Date |
decimal |
BigDecimal |
bigdecimal |
BigDecimal |
object |
Object |
map |
Map |
hashmap |
HashMap |
list |
List |
arraylist |
ArrayList |
collection |
Collection |
iterator |
Iterator |