MyBatis paging plug-in PageHelper 6.0.0 released

6.0.0 – 2023-11-05

  • Based on jdk8 adaptation, jdk6 and 7 are not supported starting from 6.0. If necessary, you can use version 5.x
  • Add asynchronous count support, global configuration asyncCount, default false, single setting: PageHelper.startPage(1, 10).enableAsyncCount();
    Asynchronous query uses independent connection (transaction). It is not suitable to enable asynchronous query when there are additions, deletions and modifications that affect the query. closed #334
  • JSqlParser is enabled by default parser.withSquareBracketQuotation(true) and supports SqlServer []
  • feat: Added a new method for data object conversion PageInfo convert(Page.Function function) in the PageInfo class by
    codeke
  • CountSqlParser is changed to an interface, allowing the countSqlParser parameter to be replaced by your own implementation, supporting #772
  • dialectAlias supports simplified configuration, such as dm=oracle;oracle=oracle9i, which directly refers to the current abbreviation without writing the full name of the class.
  • countColumnAdd injection detection, fixed #686
  • Add the PageParam class, do not embed the object (will affect the use), if you want to use it, you can inherit the object, closed #562
  • All abnormal information will be changed to English prompts
  • Free up setLocalPage to support #771
  • Solve the problem of order by error when parsing sqlserver with union sql, fixed #768
  • Optimize the total logic and solve the problem of invalidity when specifying non-paged query and specifying order by at the same time. Fixed #641
  • Modify dialect instantiation logic to ensure that the class is used after completion of configuration, fixed #742
  • dialectAliasMap was changed to LinkedHashMap, which can match according to the configuration order, fixed #758
  • Xingyun database paging bug fix by maimaitiyaer_bonc

PageHelper 6 supports jdk8 +

PageHelper 5 supports jdk6 +

Physical paging

The plug-in currently supports physical paging PageAutoDialect for the following databases:

static {<!-- -->
    //Register alias
    registerDialectAlias("hsqldb",HsqldbDialect.class);
    registerDialectAlias("h2",HsqldbDialect.class);
    registerDialectAlias("phoenix",HsqldbDialect.class);
    
    registerDialectAlias("postgresql",PostgreSqlDialect.class);
    
    registerDialectAlias("mysql",MySqlDialect.class);
    registerDialectAlias("mariadb",MySqlDialect.class);
    registerDialectAlias("sqlite",MySqlDialect.class);
    
    registerDialectAlias("herddb",HerdDBDialect.class);
    
    registerDialectAlias("oracle",OracleDialect.class);
    registerDialectAlias("oracle9i",Oracle9iDialect.class);
    registerDialectAlias("db2",Db2Dialect.class);
    registerDialectAlias("as400",AS400Dialect.class);
    registerDialectAlias("informix",InformixDialect.class);
    //Resolve informix-sqli #129, still retain the above
    registerDialectAlias("informix-sqli",InformixDialect.class);
    
    registerDialectAlias("sqlserver",SqlServerDialect.class);
    registerDialectAlias("sqlserver2012",SqlServer2012Dialect.class);
    
    registerDialectAlias("derby",SqlServer2012Dialect.class);
    //Dameng database, https://github.com/mybatis-book/book/issues/43
    registerDialectAlias("dm",OracleDialect.class);
    //Alibaba Cloud PPAS database, https://github.com/pagehelper/Mybatis-PageHelper/issues/281
    registerDialectAlias("edb",OracleDialect.class);
    //Magical database
    registerDialectAlias("oscar",OscarDialect.class);
    registerDialectAlias("clickhouse",MySqlDialect.class);
    //Hangao database
    registerDialectAlias("highgo",HsqldbDialect.class);
    //virtual valley database
    registerDialectAlias("xugu",HsqldbDialect.class);
    registerDialectAlias("impala",HsqldbDialect.class);
    registerDialectAlias("firebirdsql",FirebirdDialect.class);
    //National People's Congress Jincang database
    registerDialectAlias("kingbase",PostgreSqlDialect.class);
    // The new version of Kingbase8 of Renmin University of Finance and Economics
    registerDialectAlias("kingbase8",PostgreSqlDialect.class);
    //line cloud database
    registerDialectAlias("xcloud",CirroDataDialect.class);
    
    //openGauss database
    registerDialectAlias("opengauss",PostgreSqlDialect.class);
    
    //Register AutoDialect
    //When you want to achieve the same effect as the previous version, you can configure autoDialectClass=old
    registerAutoDialectAlias("old",DefaultAutoDialect.class);
    registerAutoDialectAlias("hikari",HikariAutoDialect.class);
    registerAutoDialectAlias("druid",DruidAutoDialect.class);
    registerAutoDialectAlias("tomcat-jdbc",TomcatAutoDialect.class);
    registerAutoDialectAlias("dbcp",DbcpAutoDialect.class);
    registerAutoDialectAlias("c3p0",C3P0AutoDialect.class);
    //When not configured, DataSourceNegotiationAutoDialect is used by default.
    registerAutoDialectAlias("default",DataSourceNegotiationAutoDialect.class);
}

If the database you are using is not in this list, you can configure the dialectAlias parameter.

This parameter allows configuring the alias of a custom implementation, which can be used to automatically obtain the corresponding implementation based on JDBCURL, allowing overriding existing implementations in this way. Configuration examples are as follows (use semicolons to separate multiple configurations):

<property name="dialectAlias" value="oracle=com.github.pagehelper.dialect.helper.OracleDialect"/>
<!-- 6.0 supports the following reference methods, citing the implementation of Oracle9iDialect.class -->
<property name="dialectAlias" value="oracle=oracle9i"/>
<!-- 6.0 supports the following reference methods. Dameng uses Oracle syntax for paging and simplifies the writing of full class names -->
<property name="dialectAlias" value="dm=oracle"/>

PageHelper Spring Boot Starter released 2.0.0

Add the following dependencies in pom.xml:

<dependency>
  <groupId>com.github.pagehelper</groupId>
  <artifactId>pagehelper-spring-boot-starter</artifactId>
  <version>2.0.0</version>
</dependency>

v2.0.0 – 2023-11-05

  • Upgrade PageHelper to 6.0.0 to support asynchronous count and other functions. View 6.0 in detail
  • Upgrade MyBatis to 3.5.15
  • Upgrade springboot to 2.7.17
  • Added new parameter asyncCount, adding asynchronous count support, default false, single setting: PageHelper.startPage(1, 10).enableAsyncCount() ;
  • New parameter countSqlParser, CountSqlParser is changed to an interface, allowing the countSqlParser parameter to be replaced with your own implementation

Parameter example:

pagehelper.async-count=true