MyBatis(3.2.3) - Paginated ResultSets using RowBounds
Sometimes, we may need to work with huge volumes of data, such as with tables with millions of records. Loading all these records may not be possible due to memory constraints, or we may need only a fragment of data. Typically in web applications, pagination is used to display large volumes of data in a page-by-page style.
MyBatis can load table data page by page using RowBounds. The RowBounds object can be constructed using the offset and limit parameters. The parameter offset refers to the starting position and limit refers to the number of records.
Suppose if you want to load and display 25 student records per page, you can use the following query:
<select id="findAllStudents" resultMap="StudentResult">
select * from Students
</select>
Then, you can load the first page (first 25 records) as follows:
int offset =0 , limit =25;
RowBounds rowBounds = new RowBounds(offset, limit);
List<Student> = studentMapper.getStudents(rowBounds);
To display the second page, use offset=25 and limit=25; for the third page, use offset=50 and limit=25.
MyBatis(3.2.3) - Paginated ResultSets using RowBounds的更多相关文章
- Table of Contents - MyBatis
Getting Started with MyBatis Hello World Integration with Spring Bootstrapping MyBatis Configuring M ...
- SSM(Spring + Springmvc + Mybatis)框架面试题
JAVA SSM框架基础面试题https://blog.csdn.net/qq_39031310/article/details/83050192 SSM(Spring + Springmvc + M ...
- mybatis查询语句的背后之参数解析
转载请注明出处... 一.前言 通过前面我们也知道,通过getMapper方式来进行查询,最后会通过mapperMehod类,对接口中传来的参数也会在这个类里面进行一个解析,随后就传到对应位置,与sq ...
- Mybatis 面试题
题目: 什么是Mybatis? Mybatis27题 Mybaits的优点 Mybatis27题 MyBatis框架的缺点 Mybatis27题 MyBatis框架适用场合Mybatis27题 My ...
- MyBatis的缓存玩法
重要概念 SqlSession:代表和数据库的一次会话,提供了操作数据库的方法. MappedStatement:代表要发往数据执行的命令,可以理解为SQL的抽象表示. Executor:和数据库交互 ...
- JavaSSM框架面试
一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心: 1.IOC/DI(控制反转/依赖注入 ...
- SSM面试题
一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心: 1.IOC/DI(控制反转/依赖注入 ...
- Java SSM 框架相关基础面试题
一.Spring 面试题 1. Spring 在 SSM 中起什么作用? Spring 是轻量级框架,作用是作为 Bean 工厂,用来管理 Bean 的声明周期和框架集成. Spring 的两大核心: ...
- SSM框架面试题及答案整理
一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心:①. IOC/DI(控制反转/依赖注入 ...
随机推荐
- 去掉 CONSOLE 窗口(转)
建立一个win32 console application的话,linker的/subsystem选项应该为CONSOLE,可以在VC开发环境的project->setting->link ...
- poj 3693 Maximum repetition substring (后缀数组)
其实是论文题.. 题意:求一个字符串中,能由单位串repeat得到的子串中,单位串重复次数最多的子串.若有多个重复次数相同的,输出字典序最小的那个. 解题思路:其实跟论文差不多,我看了很久没看懂,后来 ...
- ASP导出Word带页眉页脚,中文不乱码
关键代码: <% Response.Clear() Response.CodePage= Response.Charset="UTF-8" Response.ContentT ...
- 去除Linq to Sql 查询结果中的空格
原来的写法: Dim db = From city In DataContext1.AddressCity Where city.ProvinceID = dgvAddress(2, e.RowInd ...
- [前端JS学习笔记]JavaScript CallBack
一.概念介绍 CallBack : "回调" . 在spring优秀框架回调无处不在, 回调的运用场景很多, 如 swt事件监听.netty等.它的主要作用是提高程序执行效率, 一 ...
- IOS6 字体高亮显示
ios6之前在一个字符串中如果也让某个字体高亮或者特殊显示(如: 关注[ ]),需要用单独一个的标签进行显示,或者利用CoreText进行字体绘绘制,非常麻烦: 现在IOS6 中TextView,la ...
- 【转】Android真机抓屏- Android Screen Monitor
http://www.cnblogs.com/xiaofeixiang/p/4086092.html 一般运行Android应用程序有两种方式一种是设置Android虚拟设备模拟器,通过Android ...
- 如何将mysql表结构导出成Excel格式的(并带备注)
http://www.liangchan.net/liangchan/4561.html 1.使用一个mysql管理工具:SQLyog,点击菜单栏“数据库”下拉的最后一项: 导出的格式如下: 2.要想 ...
- Java I/O输入输出流详解
一.文件的编码 开发时一定要注意项目默认的编码!!!!!!!! 文件操作的时候一定要记得关闭!!!!!!!! ASCII:美国标准 ...
- MAC JAVA 环境变量那些事
1,查看 JAVA 的版本号 akdeMacBook-Pro:bin AK$ java -version java version "1.6.0_65" Java(TM) SE R ...