You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Gaurav Agarwal <G....@Sun.COM> on 2007/08/03 15:53:01 UTC

Setting FetchSize in iBatis

Hi,

I just wanted to know, if we can set the fetchsize for queries in 
iBatis. I wanted to do so, as the for some of the reports the query 
retrieves 10,000+ records and I wanted to reduce the no. of trips 
between appserver and db.

Any other suggestions are welcome!

-- 
Regards
Gaurav Agarwal
Sun Microsystems Account, GTS
CSC India Pvt. Ltd.
Tel: +91 120 2582323 x3590 (India)
     +1 302 781 1010 x3590 (US)
(M): +91 98106-17911


Re: Setting FetchSize in iBatis

Posted by Joe ONeil <jo...@comcast.net>.
Another method you can use is 

 @SuppressWarnings("unchecked")
    public List<StockItemsVw> selectByExampleRange(StockItemsVwExample
example,int start,int 
                                            maxRows) {
    	List<StockItemsVw> list = (List<StockItemsVw>)
getSqlMapClientTemplate().queryForList   
                ("DWOWNER_STOCK_ITEMS_VW.abatorgenerated_selectByExample",
example,start,maxRows);
    	return list;
        }
    
Start is where the query start record is and maxRows is the fetch size. 
This is places in the DAOImpl class.
you can create a more button  by increasing the start  ie start=start+50;



Clinton Begin wrote:
> 
> On the <select> tag you can set fetch size.  See the DTD.
> 
> http://ibatis.apache.org/dtd/sql-map-2.dtd
> 
> Clinton
> 
> On 8/3/07, Gaurav Agarwal <G....@sun.com> wrote:
>>
>> Hi,
>>
>> I just wanted to know, if we can set the fetchsize for queries in
>> iBatis. I wanted to do so, as the for some of the reports the query
>> retrieves 10,000+ records and I wanted to reduce the no. of trips
>> between appserver and db.
>>
>> Any other suggestions are welcome!
>>
>> --
>> Regards
>> Gaurav Agarwal
>> Sun Microsystems Account, GTS
>> CSC India Pvt. Ltd.
>> Tel: +91 120 2582323 x3590 (India)
>>      +1 302 781 1010 x3590 (US)
>> (M): +91 98106-17911
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Setting-FetchSize-in-iBatis-tf4212694.html#a12059704
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Setting FetchSize in iBatis

Posted by Clinton Begin <cl...@gmail.com>.
On the <select> tag you can set fetch size.  See the DTD.

http://ibatis.apache.org/dtd/sql-map-2.dtd

Clinton

On 8/3/07, Gaurav Agarwal <G....@sun.com> wrote:
>
> Hi,
>
> I just wanted to know, if we can set the fetchsize for queries in
> iBatis. I wanted to do so, as the for some of the reports the query
> retrieves 10,000+ records and I wanted to reduce the no. of trips
> between appserver and db.
>
> Any other suggestions are welcome!
>
> --
> Regards
> Gaurav Agarwal
> Sun Microsystems Account, GTS
> CSC India Pvt. Ltd.
> Tel: +91 120 2582323 x3590 (India)
>      +1 302 781 1010 x3590 (US)
> (M): +91 98106-17911
>
>