mybatis分頁插件pageHelper的startPage方法查詢失效問題

pageHelper插件可在spring配置文件(方式一)或mybatis配置文件(方式二)中配置
方式一:
 1 <bean id="mybatisSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
 2     <property name="dataSource" ref="dataSource"/>
 3     <property name="configLocation" value="classpath:mybatis-config.xml"/>
 4     <property name="plugins">
 5         <array>
 6             <bean class="com.github.pagehelper.PageInterceptor">
 7                 <property name="properties">
 8                     <!-- config params as the following -->
 9                     <value>
10  dialect=com.github.pagehelper.dialect.helper.OracleDialect 11                     </value>
12                 </property>
13             </bean>
14         </array>
15     </property>
16 </bean>

方式二:
1 <configuration>
2  ... 3     <plugins>
4         <plugin interceptor="com.github.pagehelper.PageInterceptor">
5             <property name="supportMethodsArguments" value="true"/>
6         </plugin>
7     </plugins>
8 </configuration>
不解的是使用方式一的配置執行startPage靜態方法時會查詢出全部記錄來,startPage方法是失效的;而採用方式二的配置則會正常。目前使用方式二的配置迴避了這個問題,但仍然疑惑……
相關文章
相關標籤/搜索