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(控制反转/依赖注入 ...
随机推荐
- WebForm 回传后如何保持页面的滚动位置
转载自 http://www.cnblogs.com/renjuwht/archive/2009/06/17/1505000.html 默认情况下,ASP.NET页面回传到服务器后,页面会跳回顶部.对 ...
- POJ 1679 The Unique MST (次小生成树)
题目链接:http://poj.org/problem?id=1679 有t组数据,给你n个点,m条边,求是否存在相同权值的最小生成树(次小生成树的权值大小等于最小生成树). 先求出最小生成树的大小, ...
- HttpContext讲解
http://www.cnblogs.com/scy251147/p/3549503.html http://www.360doc.com/content/14/0526/10/17655805_38 ...
- .NET通用权限系统快速开发框架
DEMO下载地址: http://download.csdn.net/detail/shecixiong/5372895 一.开发技术:B/S(.NET C# ) 1.Windows XP以上 (支援 ...
- 【不积跬步,无以致千里】安装roundcube 时出现 “DSN (write): NOT OK(SQLSTATE[HY000] [2002] No such file or directory)”
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- C#开发的WebService使用JSON格式传递数据+Ajax测试
[C#] WebService 使用 JSON 格式傳遞筆記 + JQuery 測試 0 2 因為一些因素,必須改寫WebService,很傳統,但是很多公司還在用.. 因為XML 的關係,不想讓他 ...
- Spring声明式事务的配置~~~
/*2011年8月28日 10:03:30 by Rush */ 环境配置 项目使用SSH架构,现在要添加Spring事务管理功能,针对当前环境,只需要添加Spring 2.0 AOP类库即可.添加 ...
- BW性能优化
少写例程,减少ABAP处理时间,例程要有效率减少查询数据库表先加载主数据,然后加载事务数据创建聚集进行数据压缩M:N关系的数据不能放到一个维度减少计算指标数量,提高上载效率并行加载建模型时如果有日的分 ...
- Windows 7系统安装MySQL5.5.21图解
Win7系统安装MySQL5.5.21图解 大家都知道MySQL是一款中.小型关系型数据库管理系统,非常具有有用性,对于我们学习非常多技术都有帮助,前几天我分别装了SQL Server 2008和Or ...
- 利用text插件和css插件优化web应用
JavaScript的模块化开发到如今,已经相当成熟了,当然,一个应用包含的不仅仅有js,还有html模板和css文件. 那么,如何将html和css也一起打包,来减少没必要的HTTP请求数呢? 本文 ...