Take the 2-minute tour ×

Thanks in advance for your input.

I use the skip parameter in iBatis in my DAO, using SQLMapClient for getting 1000 records at a time based on user request. So when the user requests the next set of records, I skip the first n number of records that has already been presented to the user.

List<Item> records = (ArrayList<Item>) sqlMap.queryForList("selectRecords", parameterMap, skip, 1000);

This works fine except for large values of skip. i.e in one of the instances the value of skip is something like 354000 and it takes a significant amount of time for iBatis to return results, if at all. Being impatient, most of the time I just kill tomcat.

What is a better way to do this? Should I deal with this in the sql query maybe, using the last id that was selected? Or maybe use rownum in the query?

Would appreciate your ideas. Thanks & Regards, VeeCan

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This stackoverflow question has one of the practical solutions that I will be pursuing.
Best way to iterate over a large resultset.

Thought I'd post this for others' benefit. Thanks for reading.

share|improve this answer
add comment

Your Answer


