mybatis 配置文件 配置别名
<?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 type="com.exayong.architecture1.customermgr.vo.CustomerModel" alias="CM"/>
<typeAlias type="com.exayong.architecture1.customermgr.vo.CustomerQueryModel" alias="CQM"/>
</typeAliases>
</configuration>
测试
@Service
public class Client {
@Autowired
private CustomerDAO dao = null;
public static void main(String[] args){
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
Client t = (Client) ctx.getBean("client");
CustomerModel cm = new CustomerModel();
cm.setCustomerId("c1");
cm.setPwd("c1");
cm.setRegisterTime("haha");
cm.setShowName("c1");
cm.setTrueName("李四");
t.dao.create(cm);
List<CustomerModel> list = t.dao.getByCondition(new CustomerQueryModel());
System.out.println("list=="+list);
}
}
posted on 2017-03-05 23:18 robert_hly 阅读(232) 评论(0) 编辑 收藏 举报