Skip to Content
avatar image
Former Member

MDME Java API - Page Problem

Hi,

I am using MDME Java API. I want to know how the multiple records running into several pages is handled. I know that there is a method SetSize() in ResultSetDefinition class and I also know that the method GetResultSet() uses the page(probably page number) as an argument. But, I am not sure how to use this feature for practical purposes.

Can anybody help me??

Thanks in Advance,

Rajani

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 10, 2005 at 03:23 AM

    Hi Rajani,

    The paging feature comes in handy if you have a very large dataset you need to iterate through. Using the page number and SetSize() method allows you to efficiently loop through the resultset. Here's some sample code:

    // loop through the resultset, retrieving a page a time until all records have been processed

    while (isDone == false) {

    A2iResultSet rs = catalog.GetResultSet(search, rsd, sortField, sortAscending, page);

    // process the records

    processProdRecords(rs);

    // increment counter

    page++;

    // are there more records?

    if ((page * pageSize) >= search.GetNumSearchTableResults())

    isDone = true;

    }

    Regards,

    Oliver

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rajani,

      Just one small comment to Oliver's reply. MDME connection classes though are quite similar to JDBC connection family by nature have one very important pecuriality. They're not stateful. So for example you don't have to close A2iResultSet as you would have done to in the JDBC analogy. Saying that, I mean that the mechanism behind the scene performs the search every time when you do fetching. Practically speaking it's not important at all since all operations are exectuted very fast (memory based in general). Just wanted to answer an anticipating question in advance about closing ResultSet object.