在做ssm項目時引入了pagehelper分頁插件,報錯:
Cause: com.github.pagehelper.PageException: 無法自動獲取數據庫類型,請通過 helperDialect 參數指定!
maven的配置爲:
<dependency>
<groupId>com.github.pagehelper</groupId>`在這裏插入代碼片`
<artifactId>pagehelper</artifactId>
<version>5.1.8</version>
</dependency>
注意:5.0版本的pagehelper可以自動掃描數據庫類型,但我這裏就報錯了!
無法自動獲取數據庫類型,請通過 helperDialect 參數指定!
於是需要將mybatis的配置文件中的
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
</plugin>
</plugins>
改爲:
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="reasonable" value="true" />
<property name="helperDialect" value="mysql" />
</plugin>
</plugins>
這樣就可以正常使用了。
希望對大家有用