cancel
Showing results for 
Search instead for 
Did you mean: 

MDME Java API - Page Problem

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.