随笔分类 - MyBatis
摘要:Mybatis-Spring 1.准备JAR包 略 2.编写配置文件 在类路径下建立下面几个文件 # db.properties jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/mybatis jdbc.u
阅读全文
摘要:MyBatis关系映射 1.一对一 ①嵌套查询 <!--IdCardMapper.xml--> <mapper namespace="com.itheima.mapper.IdCardMapper"> <select id="findCodeById" parameterType="Integer"
阅读全文
摘要:动态SQL 1.元素 元素 说明 <if> 判断语句 <choose>(<when>、<otherwise>) 相当于switch...case...default <where>、<tirm>、<set> 辅助元素,用于一些SQL的拼装、特殊字符问题 <foreach> 循环语句,常用于in子句
阅读全文
摘要:MyBatis核心配置 1.SqlSessionFactory Reader reader = Resources.getResourceAsReader("mybatis-config.xml"); SqlSessionFactory sqlSessionFactory = new SqlSess
阅读全文
摘要:MyBatis入门 1.环境搭建 https://github.com/mybatis-3/releases 下载 ① maven依赖 <!--MyBatis 3.4.2 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>myba
阅读全文

浙公网安备 33010602011771号