![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
九天之凤
岁月无声
展开
-
mybatis和spring整合
本文主要介绍了如何将mybatis和spring整合在一起使用,本人使用的是mybatis3.05 + spring3.1.0M2 ,使用dbcp作为数据库连接池。1.编写数据访问接口(UserDao.java)package com.mybatis;public interface UserDao { public int countAll();}2.编写数据访转载 2015-03-25 17:24:34 · 505 阅读 · 0 评论 -
利用mybatis-paginator实现分页
1、mybatis-paginator简介mybatis-paginator是gethub上的一个开源项目、用于java后台获取分页数据、该开源项目还提供一个列表组件(mmgrid)用于前端展示。该开源项目地址:https://github.com/miemiedev 2、该开源项目的使用说明:Maven中加入依赖: ...转载 2015-05-07 14:22:12 · 1472 阅读 · 0 评论 -
mybatis:try using the full name including the namespace, or rename one of the entries
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.IllegalArgumentException: queryFollow is ambiguous in Mapped Statements collection (try using the ful原创 2015-05-13 14:19:06 · 2878 阅读 · 0 评论 -
Mybatis SQL转义字符与like 查询
Mybatis Sql语句里一些特殊符号是必须转义的,否则无法正常运行,有些会在静态语法检查上IDE会提示,有些则只会在运行时抛出异常。需要转义的符号如下 < > > <> & & ' ' " "转载 2015-04-09 09:25:30 · 1330 阅读 · 0 评论 -
MyBatis的动态SQL详解
转自: http://haohaoxuexi.iteye.com/blog/1338557基础部分可以查看我的另一篇博客:http://haohaoxuexi.iteye.com/blog/1333271 MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑。MyBatis中用于实现动态SQL的元素主要有: ifchoos转载 2015-04-08 11:41:00 · 468 阅读 · 0 评论 -
mybatis sql in 查询
mybatis官方学习文档:http://www.mybatis.org/core/getting-started.html 本文转自:http://www.blogjava.net/xmatthew/archive/2011/08/31/355879.html1. 当查询的参数只有一个时 findByIds(List ids) 1.1 如果参数的类型是List, 则在使用转载 2015-04-08 11:14:47 · 376 阅读 · 0 评论 -
mybatis 动态SQL语句
有些时候,sql语句where条件中,需要一些安全判断,例如按某一条件查询时如果传入的参数是空,此时查询出的结果很可能是空的,也许我们需要参数为空时,是查出全部的信息。使用Oracle的序列、mysql的函数生成Id。这时我们可以使用动态sql。 下文均采用mysql语法和函数(例如字符串链接函数CONCAT)。 3.1 selectKey 标签 在i转载 2015-04-07 22:26:11 · 469 阅读 · 0 评论 -
mybatis的简单运用(xml配置方式)
本文主要介绍了如何使用mybatis进行简单的数据库操作。本人使用的是mybatis3.05。1.创建数据库表(User表)CREATE TABLE `NewTable` (`userId` bigint(20) NOT NULL AUTO_INCREMENT ,`userName` varchar(30) CHARACTER SET utf8 COLLATE ut转载 2015-03-25 16:40:57 · 659 阅读 · 0 评论 -
mybatis:"configuration" must match "(properties?,settings?,typeAliase.....
在运行mybatis配置文件的时候,出现错误:Caused by: org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrappe原创 2015-03-28 22:23:06 · 6965 阅读 · 3 评论 -
MyBatis+Spring 事务管理
在网上查了MyBatis+Spring的结合,真的是太多太多了,可是没有几个代码是完整的..这两项整合花了我两天时间,终于被我整合完成...其实也很简单,原因:JAR包的问题...由于Ibatis被改名为MyBatis,所以,网上很多都是有关Ibatis而MyBatis却很少很少...本文以MyBatis3.0.6 + Spring3.0.6为例结合(一定要这个版本才行):转载 2015-03-27 10:44:47 · 379 阅读 · 0 评论 -
mybatis 字符串比较
错误的写法 and t.room = '2'正确的写法 and t.room = '2'差别在哪里?注意 'room != null and room =="02" '>单双引号的使用!原创 2015-06-08 08:56:45 · 2197 阅读 · 0 评论