Mybaties
yaoxiaoxu
这个作者很懒,什么都没留下…
展开
-
myBaties集到springboot中,别名配置失效
我的配置mybatis: ##如果直接这样配置启动项目会报错,错误如下 type-aliases-package: com.yao.**.entity mapper-locations: classpath*:/mapper/**/**Mapper.xml,classpath*:/mapper/**Mapper.xml config-location: classpath:/config/mybaties.cfg.xml报错信息(有删减):org.springframework.bea原创 2020-08-18 11:06:04 · 1453 阅读 · 0 评论 -
使用Mybaties插入数据时返回主键
useGeneratedKeys和keyProperty配置即可,前者是指设置是否使用jdbc的getGenereatedKeys方法获取主键并赋值到keyProperty设置的属性中,后者即实体类主键字段e.g: xml文件 <insert id="insert2ReturnId" useGeneratedKeys="true" keyProperty=&原创 2018-11-06 14:48:41 · 361 阅读 · 0 评论 -
mybaties防止注入
都没测试过。。。。慎用MySql: select * from t_user where name like concat('%', #{name}, '%') Orcle: select * from t_user where name like '%' || #{name} || '%'sqlServer select * from t_user where name li...原创 2018-11-21 10:16:05 · 147 阅读 · 0 评论 -
mybaties在springBoot .yml中的配置
mybatis-plus: #外部化xml配置 #config-location: classpath:mybatis-config.xml #指定外部化 MyBatis Properties 配置,通过该配置可以抽离配置,实现不同环境的配置部署 #configuration-properties: classpath:mybatis/config.properties #xm...原创 2019-03-31 16:14:08 · 2343 阅读 · 1 评论 -
关闭mybaties一级缓存
添加flushCache=“true”例: <select id="findByStartAndEndTime" flushCache="true" parameterType="hashmap" resultMap="WtspStatusMap"> select t.* from T_WTSP_STATUS t <where> ...原创 2019-07-17 14:35:29 · 402 阅读 · 0 评论