随笔分类 -  Mybatis

摘要:先给大家介绍下MyBatis中#{}和${}的区别,具体介绍如下: 1. $将传入的数据直接显示生成在sql中2. #方式能够很大程度防止sql注入。 3.$方式无法防止Sql注入。4.$方式一般用于传入数据库对象,例如传入表名.5.一般能用#的就别用$.MyBatis排序时使用order by 动 阅读全文
posted @ 2017-03-17 09:17 IT~任重而道远 阅读(766) 评论(0) 推荐(0)
摘要:mybatis文档:http://www.mybatis.org/mybatis-3/zh/getting-started.html mybatis-spring文档:http://www.mybatis.org/spring/zh/ 阅读全文
posted @ 2017-03-15 23:33 IT~任重而道远 阅读(698) 评论(0) 推荐(0)
摘要:SqlSessionFactoryBuilder这个类可以被实例化、使用和丢弃,一旦创建了 SqlSessionFactory,就不再需要它了。因此 SqlSessionFactoryBuilder 实例的最佳作用域是方法作用域(也就是局部方法变量)。你可以重用 SqlSessionFactoryB 阅读全文
posted @ 2017-03-15 23:25 IT~任重而道远 阅读(1615) 评论(0) 推荐(0)
摘要:从 XML 中构建 SqlSessionFactory 每个基于Mybatis应用都是以一个SqlSessionFactory实例为中心。SqlSessionFactory实例可以由SqlSessionFactoryBuild获得,而SqlSessionFactoryBuild可以以一个xml配置文 阅读全文
posted @ 2017-03-15 23:15 IT~任重而道远 阅读(12847) 评论(0) 推荐(1)
摘要:错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String' 映射器类 阅读全文
posted @ 2017-03-15 17:22 IT~任重而道远 阅读(89040) 评论(2) 推荐(7)
摘要:错误异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.dao.NarCodeMapper.getNarCode 出现这个原因:Mybatis的Mapper inte 阅读全文
posted @ 2017-03-14 22:27 IT~任重而道远 阅读(566) 评论(0) 推荐(0)
摘要:异常错误:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [test1- 阅读全文
posted @ 2017-03-14 21:51 IT~任重而道远 阅读(16988) 评论(0) 推荐(0)