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的更多相关文章

  1. Table of Contents - MyBatis

    Getting Started with MyBatis Hello World Integration with Spring Bootstrapping MyBatis Configuring M ...

  2. SSM(Spring + Springmvc + Mybatis)框架面试题

    JAVA SSM框架基础面试题https://blog.csdn.net/qq_39031310/article/details/83050192 SSM(Spring + Springmvc + M ...

  3. mybatis查询语句的背后之参数解析

    转载请注明出处... 一.前言 通过前面我们也知道,通过getMapper方式来进行查询,最后会通过mapperMehod类,对接口中传来的参数也会在这个类里面进行一个解析,随后就传到对应位置,与sq ...

  4. Mybatis 面试题

    题目: 什么是Mybatis?  Mybatis27题 Mybaits的优点 Mybatis27题 MyBatis框架的缺点 Mybatis27题 MyBatis框架适用场合Mybatis27题 My ...

  5. MyBatis的缓存玩法

    重要概念 SqlSession:代表和数据库的一次会话,提供了操作数据库的方法. MappedStatement:代表要发往数据执行的命令,可以理解为SQL的抽象表示. Executor:和数据库交互 ...

  6. JavaSSM框架面试

    一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心: 1.IOC/DI(控制反转/依赖注入 ...

  7. SSM面试题

    一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心: 1.IOC/DI(控制反转/依赖注入 ...

  8. Java SSM 框架相关基础面试题

    一.Spring 面试题 1. Spring 在 SSM 中起什么作用? Spring 是轻量级框架,作用是作为 Bean 工厂,用来管理 Bean 的声明周期和框架集成. Spring 的两大核心: ...

  9. SSM框架面试题及答案整理

    一.Spring面试题 1.Spring 在ssm中起什么作用? Spring:轻量级框架 作用:Bean工厂,用来管理Bean的生命周期和框架集成. 两大核心:①. IOC/DI(控制反转/依赖注入 ...

随机推荐

  1. 利用 SQL Monitor 查看语句运行状态步骤

    利用 SQL Monitor 查看语句运行状态步骤 1.确定语句被 SQL Monitor 监控 SQL> SELECT * FROM GV$SQL_MONITOR WHERE sql_id=' ...

  2. Cocos2d-x——CocosBuilder官方帮助文档翻译2 多分辨率支持

    Working with Multiple Resolutions 多分辨率设置 A common scenario when creating apps or games is to target ...

  3. 【转】安装Intel HAXM为Android 模拟器加速,30秒内启动完成

    http://www.cnblogs.com/Li-Cheng/p/4351966.html http://www.cnblogs.com/csulennon/p/4178404.html https ...

  4. VHD_Update_diskpart

    ###################功能说明########################该脚本用来对离线VHD文件更新,导入系统补丁############################### ...

  5. Codeforces Gym 100431G Persistent Queue 可持久化队列

    Problem G. Persistent QueueTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudg ...

  6. Linux - 打印文件夹全部文件 代码(C)

    列出文件夹全部文件 代码(C) 本文地址:http://blog.csdn.net/caroline_wendy 首先配置环境,參考:http://blog.csdn.net/caroline_wen ...

  7. 详解Android Handler的使用-别说你不懂handler

    我们进行Android开发时,Handler可以说是使用非常频繁的一个概念,它的用处不言而喻.本文就详细介绍Handler的基本概念和用法. Handler的基本概念         Handler主 ...

  8. 苹果Swift语言中文教程资源汇总

    苹果swift语言中文教程(零)搭配环境以及代码执行成功http://vjiazhi.com/kaifa/1014.html 苹果Swift语言中文教程(一)基础数据类型 http://vjiazhi ...

  9. Jquery Validate根据其他元素的事件来触发单个元素的异步校验

    场景:在做一个车辆信息管理模块,而车牌是通过车牌颜色和车牌号码来确定唯一性的,录入车牌信息时需对车牌进行唯一性校验.

  10. Ruby on Rails Tutorial 第一章 之 Git项目管理

    1.安装和设置 (1)git的安装(略) (2)初始化设置 $ git config --global user.name "LihuaSun" $ git config --gl ...