一.mybatis处理CLOB.BLOB类型数据 CLOB:大文本类型:小说啊等大文本的:对应数据库类型不一致,有long等: BLOB:二进制的,图片:电影.音乐等二进制的: 在mysql中: blob: longblob:存储的东西比blob更大: longtext:存储大文本类型的:   新建t_studeng表: create table t_student( id int primary key auto_increment, name ), age int, pic longblob…
一.mybatis分页-逻辑分页和物理分页: 逻辑分页: mybatis内置的分页是逻辑分页:数据库里有100条数据,要每页显示10条,mybatis先把100条数据取出来,放到内存里,从内存里取10条:虽然取出的是10条,但是性能不好,几千条上万条没问题,数据量大性能就有问题了:小项目使用没问题:正式的项目数据量都很大就不使用了:   物理分页: 开发的时候用的:拼sql,真正实现分页:   现有数据库记录:   1.逻辑分页 1)测试代码StudentTest2.java: package…
主流开发还是使用xml来配置:使用注解配置比较快,但是不支持所有功能:有些功能还是得用配置文件: 一.基本映射语句: @Inert @Update @Delete @Select 二.结果集映射语句 项目结够: Student.java model实体类: package com.cy.model; public class Student{ private Integer id; private String name; private Integer age; public Student(…
一.mybatis传入多个参数: 前面讲传入多个参数都是使用map,hashmap:key value的形式:-- 项目中开发都建议使用map传参: 比如现在通过两个参数,name和age来查询: 通过两个参数来查的,了解下就行了:   数据库中存在t_student记录: 1)测试代码StudentTest.java: @Test public void testSearchStudents() { logger.info("根据name和age查询学生"); List<Stu…
一.使用注解配置映射器 动态sql: 用的并不是很多,了解下: Student.java 实体bean: package com.cy.model; public class Student{ private Integer id; private String name; private Integer age; public Student(){ } public Student(String name, Integer age){ this.name = name; this.age =…
MyBatis provides built-in support for mapping CLOB/BLOB type columns. Assume we have the following table to store the Students and Tutors photographs and their biodata: CREATE TABLE USER_PICS ( ID ) NOT NULL AUTO_INCREMENT, NAME ) DEFAULT NULL, PIC B…
BLOB和CLOB都是大字段类型. BLOB是按二进制来存储的,而CLOB是可以直接存储文字的. 通常像图片.文件.音乐等信息就用BLOB字段来存储,先将文件转为二进制再存储进去.文章或者是较长的文字,就用CLOB存储. BLOB和CLOB在不同的数据库中对应的类型也不一样: MySQL 中:clob对应text/longtext,blob对应blob Oracle中:clob对应clob,blob对应blob MyBatis提供了内建的对CLOB/BLOB类型列的映射处理支持. 建表语句: c…
1. 表结构 1.1 在Mysql中的数据类型,longblob  -->  blob, longtext --> clob 2. 配置文件, 请参考  myBatis之入门示例 3. LOB.java package com.blueStarWei.entity; public class LOB { private Integer id; private byte[] picture;//BLOb --> byte[] private String remark;//CLOB --&…
CLOB数据mysql对应数据类型为longtext.BLOB类型为longblob: model实体: ... private Integer id; private String name; private int age; private byte[] pic; // 映射blob private String remark; // 映射longtext ... 1.blob.clob数据插入: <insert id="insertStudent" parameterTyp…
1.在sqlMapConfig中,定义一个typeHandlers <typeHandlers> <typeHandler jdbcType="BLOB" javaType="byte[]" handler="org.apache.ibatis.type.BlobTypeHandler"/> </typeHandlers> 2.在mapper里面定义resultmap的result column <res…