java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.github.pagehelper.Page

出现这个错误,首先看配置mybatis-config.xml中的
<plugins>
<plugin interceptor="com.github.pagehelper.PageHelper" />
<!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库-->
<!-- <property name="dialect" value="mysql"/> -->
<!-- </plugin> -->
</plugins>
这个有没有配置。注意:在com.github.pagehelper.PageHelper这个包为4.0以后的就不用写下面的数据库类型了,会自动识别。

然后看类里面的:
PageHelper.startPage(pageNum, pageSize);
Page<Device> page=(Page<Device>)deviceMapper.selectByExample(null);
return new PageResult(page.getTotal(),page.getResult());
PageHelper.startPage这个与下面语句是否为查询有关,这个是网上说的,具体是怎样我也不清楚,反正我的都可以


基本就是这两条。

posted @ 2019-03-27 18:36  空杯+空船  阅读(7366)  评论(1编辑  收藏  举报