Mybatis之typeAlias配置的3种方法
转载
1.定义别名:
<typeAliases>
<typeAlias alias="User" type="cn.lxc.vo.User" />
</typeAliases>
2.扫描包方式:
<typeAliases>
<package name="cn.lxc.vo" />
</typeAliases>
3.注解方式:
package cn.lxc.vo;
import org.apache.ibatis.type.Alias;
@Alias("User")
public class User {
private int id;
private String name;
private int age;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}