Springboot連接Greenplum,分頁查詢


1.springboot分頁查詢greenplum數據報錯:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: com.github.pagehelper.PageException: 無法自動獲取數據庫類型,請通過 helperDialect 參數指定!
### Cause: com.github.pagehelper.PageException: 無法自動獲取數據庫類型,請通過 helperDialect 參數指定!
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
    at com.sun.proxy.$Proxy151.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
    at com.sun.proxy.$Proxy171.searchBloomInfoListByDate(Unknown Source)

在application.properties添加如下配置(必須配置在配置文件中,不能在自定義Config類中配置):

pagehelper:
helper-dialect: postgresql
reasonable: true
support-methods-arguments: true
params: true
default-count: true
 page-size-zero: true

 2.在Pagehelper的查詢語句中,count 函數自動過濾掉了order by語句,特殊情況保留的需在 order by 語句前面添加   /*keep orderby*/  注釋標識。

  注:如果使用了druid作為項目的數據庫連接池還需配置druid防御SQL注入攻擊 druid.wall.commentAllow=true   //是否允許語句中存在注釋 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM