如何为iBatis select语句设置fetchSize [英] How to set fetchSize for iBatis select statement

查看:586
本文介绍了如何为iBatis select语句设置fetchSize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Java中使用iBatis作为ORM框架。
我有一个选择语句

I'm using iBatis as ORM framework in Java. I have a select statement

<select id="getList" resultMap="correctMap">
    SELECT *
    FROM SOME_TABLE
</select>

我正在使用queryForList方法:

And I'm using queryForList method:

List<MappedObject> list = getSqlMapClientTemplate().queryForList("getList");

但是它检索到大量数据并且此查询的性能非常慢。

But it retrieves a big amount of data and performance of this query is pretty slow.

我对这个问题的假设是iBatis有默认的提取大小(例如在JDBS中是10)所以这就是为什么它这么慢。所以我想设置更大的提取大小(例如1000)。我怎么能这样做?

My assumption about this issues that iBatis has default fetch size (e.g. like in JDBS is 10) so that is why it so slow. So I want to set bigger fetch size (1000 for example). How I can do so?

还是我看错了?

注意:我需要所有数据所以设置最大结果 queryForList 方法对我来说不合适。

NOTE: I need all data so set max results in queryForList method is not a appropriate solution for me.

List queryForList(String id,
                  Object parameterObject,
                  int skip,
                  int max) 


推荐答案

<select id="SELECT_TABLE" parameterType="String" fetchSize="500" resultType="hashmap">
    SELECT * FROM TABLE WHERE NAME = #{value}
</select>

这篇关于如何为iBatis select语句设置fetchSize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆