mybatis - 关于IDialect not support 以及 helperDialect 参数指定

255 阅读1分钟

世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。

对于常用的数据库,如mysql等可能不会出现这种问题,但是对于非常用数据库,如kingbase8,在使用分页工具时会因为没有指定方言而报错。以下针对kingbase8:

  1. 针对PaginationInterceptor,会报IDialect not support,这时的解决方案是:
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setDialectType("postgresql");
  1. 针对PageHelper,会报helperDialect未指定的错误,这时的解决方案是:
在application.yml中配置 :
pagehelper:
  helper-dialect: postgresql