Use paging to move easily through large data sets by limiting the amount of data from a DataGraph that is pulled into memory. The API for the JDBC data mediator service (DMS) provides two interfaces that you can use to implement paging.
The DMS limits the size of the DataGraph based on the page size. For example, if the paging size is ten and you supply metadata that defines customers, the DMS creates the first page of the DataGraph with the first ten customer DataObjects. The next page contains the next ten customers in another DataGraph, and the next page is another DataGraph with the next ten customers. The DMS will continue to create DataGraphs until the all of the paged DataObjects have been used.
The DMS for JDBC provides paging at the root of the graph, so there is no restriction to the number of related DataObjects that can be returned. For example, if you provide metadata to the DMS that defines customers and related orders, the customers are the metadata that is paged. If the page size is set to ten, then the first page is a graph with the first ten customers and all of the orders that are related for each customer.
CountingPager pager = PagerFactory.soleInstance.createCountingPager(5); int count = pager.pageCount(mediator); for (int i = 1, i <= count, i++) { DataObject graph = pager.page(i, mediator); // Iterate through all returned customers in the // current page. Iterator iter = graph.getList("CUSTOMER").iterator(); while (iter.hasNext()) { DataObject cust = (DataObject) iter.next(); System.out.println(cust.getString("CUSTFIRS NAME")); } }