mybatis
文章平均质量分 67
AuroraPetard
这个作者很懒,什么都没留下…
展开
-
log4.properties db.properties
# Global logging configuration #\u5728\u5f00\u53d1\u73af\u5883\u4e0b\u65e5\u5fd7\u7ea7\u522b\u8981\u8bbe\u7f6e\u6210DEBUG\uff0c\u751f\u4ea7\u73af\u5883\u8bbe\u7f6e\u6210info\u6216errorlog4j.root原创 2018-03-16 13:01:09 · 377 阅读 · 0 评论 -
mybaris二级缓存
mybatis的二级缓存是namespace级别的,即每个mapper.xml中,开启在sqlmapconfig.xml中二级缓存的配置,默认为true-->setting name="cacheEnabled" value="true"/>在需要开启二级缓存的mapper.xml中一级缓存是sqlsession级别中的,即同一个sqlsession中二级缓存是多个s原创 2018-04-06 11:06:29 · 174 阅读 · 0 评论 -
mybatis延迟加载
sqlmapConfig.xml中settings> 开启延迟加载--> setting name="lazyLoadingEnabled" value="true"/> 不积极加载,只有方法中调用遍历返回的list然后getUser才触发--> setting name="aggressiveLazyLoading" value="false"/>set原创 2018-04-05 10:16:36 · 110 阅读 · 0 评论 -
resultMap 一对多 多对多查询
resultMap resultMap id="findOrdersdetail" type="com.lzq.pojo.orders" extends=""> 是查询对应的字段 字段 property是pojo中--> id column="id" property="id"/> result column="user_id" javaType="use原创 2018-04-04 10:21:47 · 1753 阅读 · 0 评论 -
idea maven mybatis建立
web-apppomproject xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/原创 2018-03-12 13:10:45 · 431 阅读 · 0 评论 -
idea mybatis cannot find xml以及一些注意事项
映射文件和java工程在一起,sqlmapconfig.xml在maven webapp中的resources,但编译运行却报exception cannot find 映射文件,查看编译后的文件发现即target中没有Dept.xml解决办法只需要在pom中加入 mybatis-base src/main/java原创 2018-03-14 11:33:26 · 2179 阅读 · 0 评论 -
mybatis一些总结
xml version="1.0" encoding="UTF-8" ?>mapper PUBLIC "-//mybatis.org//DTDConfig 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">mapper namespace="test"> select id="findUser原创 2018-03-30 12:26:52 · 95 阅读 · 0 评论 -
resultType resultMap
xml version="1.0" encoding="UTF-8" ?>mapper PUBLIC "-//mybatis.org//DTDConfig 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">mapper namespace="com.lzq.mapper.OrderMapper">原创 2018-03-30 12:22:53 · 124 阅读 · 0 评论 -
mybatis mapper代理开发
传统dao实现,有很多重复代码,所以采用mapper代理开发,1创建userMapper.xml,mapper namespace为mapper接口的类名2创建userMapper.java 接口类需要遵循一些规范,方法名 返回值 参数与mapper.xml中一一相对应,但有一点需要注意,如果返回的是多条值就要是list等集合,如模糊查询,返回值类型就不一定要和mapper.x原创 2018-03-20 12:02:27 · 161 阅读 · 0 评论 -
mybatis逆向工程
error log时一定要仔细看一下,可能一个错误导致其他很多错误的出现,所以找准最根本的错误新建 maven添加dependency webapp finish 但工程目录中可能会缺少java目录或resource目录所以创建java目录 https://blog.csdn.net/u014756827/article/details/52497572创建资源目录原创 2018-04-11 13:03:46 · 114 阅读 · 0 评论