摘要: resultType:直接表示返回类型resultMap:对外部resultMap的引用二者不能同时使用创建一个实体类Role和Userpublic class Role { private Integer id; private String roleCode; private ... 阅读全文
posted @ 2015-11-12 16:51 夏末、初秋 阅读(963) 评论(0) 推荐(0) 编辑
摘要: 这2种方法的区别:1、添加接口 2、运用接口来实现其他的都一样添加接口//接口的名字和xml的名字一样,这样xml中的namespace就不用改public interface UserMapper { //接口名的方法名一定要和xml中的id名一样 public int count()... 阅读全文
posted @ 2015-11-12 12:02 夏末、初秋 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 在UserMapper.xml中添加增删改查 insert into user(userCode,userName,userPassword) values (#{userCode},#{userName},#{userPa... 阅读全文
posted @ 2015-11-12 11:31 夏末、初秋 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 增加@Test public void addTest(){ String resource = "mybatis-config.xml"; SqlSession sqlSession = null; try { User use... 阅读全文
posted @ 2015-11-12 10:57 夏末、初秋 阅读(873) 评论(0) 推荐(0) 编辑
摘要: 搭建MyBatis开发环境,实现用户表记录数查询 1、在MyEclipse中创建工程,导入MyBatis的jar包 2、创建MyBatis配置文件mybatis-config.xml配置数据库信息mybatis-config.xml文件 ... 阅读全文
posted @ 2015-11-12 09:24 夏末、初秋 阅读(7142) 评论(0) 推荐(0) 编辑