Try OpenEdge Now
skip to main content
Java Open Clients
Using SmartDataObjects from Java Clients : Creating an SDOResultSet object : Understanding SDOResultSet scrolling modes
 

Understanding SDOResultSet scrolling modes

Different scrolling modes allow you to control response time, memory requirements, and the ResultSet isolation level. The isolation level (in this context) is the visibility of modifications made to the ResultSet by applications other than the current Open Client. Each mode represents tradeoffs between these requirements and capabilities. You can set the scrolling mode on the SDOParameters object using the setScrollingMode(SDOScrollingModeconstant) method and pass the object to the _createSDOResultSet() factory method. The value of constant is a class constant of the SDOScrollingMode class provided by com.progress.open4gl. The values you can pass for constant are as follows:
*SDOScrollingMode.PREFETCH — This is the default and only allowable mode for a stateless SDOResultSet. In this mode, the whole ResultSet is fetched into memory when the SDOResultSet object is created. The response time and amount of memory required is directly related to the size of the ResultSet. This mode creates the highest level of isolation. (For more information, see the information on visibility of updates in Updating SDOResultSet objects.) The size of the ResultSet is known from the beginning and does not change until the ResultSet is closed or the query is reopened. Also, navigation in this mode is guaranteed to be fast since all the rows are in memory. This mode is ideal for small ResultSets in combination with slow networks.
Note: If you are accessing a large ResultSet, you might want to use the setPrefetchMaxRows() method to limit the number of rows you fetch. Otherwise, your Java application can run with an excessively long response time and large memory consumption. This can be a special problem for applications accessing stateless SDOResultSets, which always are in the PREFETCH scrolling mode. For more information, see Understanding SDOResultSet stateless mode.
*SDOScrollingMode.KEEP_ROWS — This is the default mode for an SDOResultSet that is not stateless. The rows are not prefetched but retrieved from the AppServer on demand. Rows that were retrieved are kept in memory until the ResultSet is closed or a row is refreshed or updated. The response time to get the first rows in KEEP_ROWS mode is shorter than in PREFETCH mode. Stateless SDOResultSets do not support this mode (see Understanding SDOResultSet stateless mode.
*SDOScrollingMode.FORWARD_ONLY — In this mode, only the next() navigation method is supported; the cursor cannot be randomly repositioned. Since there is no need to maintain an in-memory cache of rows, the amount of required memory does not depend on the size of the ResultSet. This scrolling mode should be used, therefore, when a large ResultSet is accessed and the next() method is sufficient; no other navigation methods are required.