ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Poitras Christian <Christian.Poit...@ircm.qc.ca>
Subject RE: queryForList()
Date Fri, 17 Oct 2008 17:08:51 GMT
It would be better if your code would do one of the following.
1) Use a RowHandler. This is optimized for these kind of queries.
2) Use maxCount in your SQL statement and not in queryForList. Some connectors don't use maximum
count to limit the number of results sent from the database. In these cases limiting number
of results in the SQL statement is your only choice.

I would go with solution 1 unless you cannot use a RowHandler.


-----Original Message-----
From: John Chien [mailto:john.chien@ncmail.net]
Sent: Friday, October 17, 2008 11:02 AM
To: user-java@ibatis.apache.org
Subject: queryForList()

Dear Sir:

I used the SQLMAP' s API queryForList to get data back from database.
There are many data in database, so I the one that has four input parameters.
The SQLMAP XML syntax should return me 10198 records, if runs without loop.
I have already tested this by plugin the values.

However, I have it runs in loop and bring back 500 records every time.
It should run 21 times. However, it returns null at the 12 loops (very consistently. I try
many times) I am wondering what might be the problem.


John Chien

Following is my code:
   ArrayList list = null;
   int skipCount = 0;
   int maxCount = 500;
   boolean done = false;
   int facilityCount = 0;

   while (! done) {
        list = (ArrayList)
formBean, skipCount, maxCount);
        if ((list != null) && (list.size() > 0)) {
            for (int i = 0; i < list.size(); i++) {
                  FacilityNameAddressBean facility =
(FacilityNameAddressBean) list.get(i);
                  insertFirstBillingRecord(formBean, facility.getId(), userId);

               skipCount += list.size();

               if (list.size() < maxCount) {
                   done = true;
           } else {
               done = true;


View raw message