注解方式:
(1)删除
IUserDao.xml
(2)添加注解
@Select("select * from user")
List<User> findAll();
(3)修改SqlMapConfig.xml
去掉
<mapper resource="cn/rzpt/dao/IUserDao.xml"></mapper>
添加
<mapper class="cn.rzpt.dao.IUserDao">
把IUserDao.xml删除,在dao接口的方法上使用@Select注解,并且制定sql语句,同时需要在SqlMapConfig.xml中的mapper配置时,使用class属性指定dao接口的全限定类名