1、原因
oracle驱动默认fetchSize是10,每次网络报会传送fetchSize条记录到客户端
2、解决方法
(1)、在 MyBatis 配置文件中设置全局 fetchSize
<!-- mybatis-config.xml -->
<configuration>
<settings>
<setting name="defaultFetchSize" value="1000"/>
</settings>
<!-- 其他配置 -->
</configuration>
(2)、给对应sql设置fetchSize
<select id="get" fetchSize="1000">
SELECT *
FROM TableA
<where>
<if test="id != null and id != ''">id = #{id}</if>
</where>
</select>