MyBatis
孤独人生
我孤独,故我释然!!!
展开
-
我们一起读文档,学习MyBatis(一)----------- 一个简单demo的实现
第一步,创建SqlSessionFactory,方法有两种: 第一种:根据XML配置创建(Building SqlSessionFactory from XML) java源代码:String resource = "mybatis-config.xml";InputStream inputStream = null;try { inputStrea...2013-03-10 16:55:18 · 72 阅读 · 0 评论 -
关于Mybatis的 XML fragments parsed from previous mappers already contains value for
我的报的错误如下: XML fragments parsed from previous mappers already contains value for com.geniusvideo.web.front.user.dao.AppExpertDao.basecolumns 有个博客的原因是:发现是sql映射到XML的parameterType或者resultType写的有问题...2014-03-13 16:02:59 · 3043 阅读 · 0 评论 -
跟我一起学Mybatis之(八)---- Result Maps、Auto-mapping、cache
1. Result Maps resultMap元素是Mybatis里面最重要的并且功能最强大的一个元素。(The resultMapelement is the most important and powerful element in MyBatis.)与JDBC从ResultSets中取值相比较它可以使用节省大约90%的代码。不过多的说了,下面开始resutMap之旅~一个...原创 2014-02-20 19:57:02 · 151 阅读 · 0 评论 -
跟我一起学Mybatis之(七)----sql、Parameters、String Substitution
首先,我把调用方法的方式换了一下,先提前说明,防止造成问题,具体如下: private SqlSession session = null; private PersonDao dao = null; @Before public void before(){ session = MybatisTool.getSession(); dao = sessio...2014-02-08 16:27:51 · 173 阅读 · 0 评论 -
跟我一起学Mybatis之(六)----增删改
其实只要执行成功了查询语句以后,其他的还是比较容易了,因为基础的语法已经熟悉了。下面开始: 1. Insertdao代码: Object insertPerson(Person person); PersonDao.xml中的sql:<insert id="insertPerson" parameterType="Person"> insert into...2014-01-26 20:00:31 · 67 阅读 · 0 评论 -
跟我一起学Mybatis之(五)----具体的操作
这次呢,主要是介绍使用,不介绍翻译了,先大概介绍一下: <select id="selectPerson" parameterType="int" resultType="hashmap">SELECT * FROM PERSON WHERE ID = #{id}</select> 上面的这个生命将会调用selectPerson,有一个参数的类型是in...2014-01-24 16:06:18 · 85 阅读 · 0 评论 -
跟我一起学Mybatis之(四)----Mapper XML Files
文章中在这块之前还有一大块东西---Configuration XML,详细介绍了Mybatis的配置文件中的结构及其元素,但是这里我感觉新手还是比较注重学习应用,因此,我也是把配置文件的介绍详细看了一下,也没有做太多的实践查看效果操作,也不多做介绍。给大家推荐一个链接:http://mybatis.github.io/mybatis-3/, 这里面有Mybatis的文档的翻译,而且有多国语言...2014-01-24 14:28:13 · 73 阅读 · 0 评论 -
跟我一起学Mybatis之(三)----Scope and Lifecycle
更喜欢原味的英语,所以就用Scope and Lifecycle,没有翻译。下面是文档中关于几个重要的类实例的Scope and Lifecycle介绍,英语水平有限,仅仅大概理解一下: SqlSessionFactoryBuilderThis class can be instantiated, used and thrown away.There is no need to ...2014-01-23 16:29:30 · 89 阅读 · 0 评论 -
我们一起读文档,学习MyBatis(二)----------- Insert Update Delete操作的实现
在这里,我会直接写Insert Update Delete操作的简单实现,文档中从一个简单的demo到这些操作中间介绍了很多关于配置文件的详细信息,由于我水平有限,仅仅把这些具体的实现做到了,配置中还有很多东西不能够完全理解,为了不误导那些意外看到这个博客的人,便不多讲述。如果想要深入理解的话,可以看文档,或者再找一些其他好的资料。 还有,时间可能会比较紧张,所以,我在这里吧源码贴出来,...2013-03-11 11:57:28 · 273 阅读 · 0 评论 -
MyBatis异常Parameter 'title' not found
异常内容如下:Cause: org.apache.ibatis.binding.BindingException: Parameter 'title' not found. Available parameters are [1, 0, param1, param2] at org.apache.ibatis.exceptions.ExceptionFactory.wrapExcept...2013-03-11 11:14:07 · 407 阅读 · 0 评论 -
Spring Test问题
错误信息如下:java.lang.NoSuchMethodError: org.springframework.beans.BeanUtils.instantiateClass(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object; at org.springframework.test.context.ContextLoader...原创 2014-04-14 18:08:59 · 206 阅读 · 0 评论