# Pagination with MyBatis

**URL:** <https://forum.flowable.org/t/pagination-with-mybatis/7396>\
**Category:** Flowable Engine\
**Created:** [January 26, 2021, 5:19pm UTC](https://forum.flowable.org/t/pagination-with-mybatis/7396 "2021-01-26T17:19:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bijeshcnair](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/bijeshcnair/32/1452_2.png) [@bijeshcnair](https://forum.flowable.org/u/bijeshcnair)\
**Post date:** [January 26, 2021, 5:19pm UTC](https://forum.flowable.org/t/pagination-with-mybatis/7396/1 "2021-01-26T17:19:40Z")

</div>

Hi ,  
I want to use mybatis for some custom queries on flowable database.  
Anybody used mybatis pagehelper plugin for pagination?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [February 8, 2021, 9:15am UTC](https://forum.flowable.org/t/pagination-with-mybatis/7396/2 "2021-02-08T09:15:59Z")

</div>

No, haven’t used that plugin. But you can do custom MyBatis queries as described here: [Advanced · Flowable Open Source Documentation](https://flowable.com/open-source/docs/bpmn/ch18-Advanced/#execute-custom-sql)

---

<div class="post-metadata">

**Author:** ![dcwik96](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dcwik96](https://forum.flowable.org/u/dcwik96)\
**Post date:** [March 9, 2021, 8:51pm UTC](https://forum.flowable.org/t/pagination-with-mybatis/7396/3 "2021-03-09T20:51:44Z")

</div>

Is there mistake in docs [Advanced - XML based Mapped Statements](https://flowable.com/open-source/docs/bpmn/ch18-Advanced/#xml-based-mapped-statements) ?

Example of AttachmentQuery

```auto
@Override
  public long executeCount(CommandContext commandContext) {
    return (Long) commandContext.getDbSqlSession()
                   .selectOne("selectAttachmentCountByQueryCriteria", this);
  }

  @Override
  public List<Attachment> executeList(CommandContext commandContext, Page page) {
    return commandContext.getDbSqlSession()
            .selectList("selectAttachmentByQueryCriteria", this);
  }

```

There is no such method like getDbSqlSession() in CommandContext class

In example on [GitHub](https://github.com/flowable/flowable-engine/blob/51d5dac5052d2863b40e599f7fd1de3dc6366d12/modules/flowable-engine/src/test/java/org/flowable/standalone/cfg/AttachmentQuery.java#L27) there is [CommandContextUtil](https://github.com/flowable/flowable-engine/blob/51d5dac5052d2863b40e599f7fd1de3dc6366d12/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/util/CommandContextUtil.java#L39) class used.

---

<div class="post-metadata">

**Author:** ![dbmalkovsky](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/dbmalkovsky/32/31_2.png) [@dbmalkovsky](https://forum.flowable.org/u/dbmalkovsky)\
**Post date:** [March 10, 2021, 7:56pm UTC](https://forum.flowable.org/t/pagination-with-mybatis/7396/4 "2021-03-10T19:56:06Z")

</div>

This [PR](https://github.com/flowable/flowable-engine/pull/2846) should fix the documentation issue.
