Try OpenEdge Now
skip to main content
Java Open Clients
Using SmartDataObjects from Java Clients : Working with SDOResultSet objects : Updating SDOResultSet objects : Using batch mode [extension]
Using batch mode [extension]
Batch mode allows an Open Client to send several updates to the AppServer in one transaction. Depending on your application requirements, this might be a better update strategy than generating a transaction for each update method:
*If your application requires user feedback for each update method applied, you generally must complete a transaction for each update method and Batch mode is not appropriate.
*If your application requires that a group of updates be applied and succeed together, you must group the updates into a single large transaction. You can do this by using an automatic transaction or by using Batch mode. For information on automatic transactions, see OpenEdge Application Server: Developing AppServer Applications.
*If your application has the option of applying several updates individually or as a group, you can generally increase performance dramatically by grouping the updates into a single large transaction using Batch mode.
*If your SDOResultSet is in Stateless mode, you can apply modifications only under Batch mode.
The following table lists the SDOResultSet methods that support Batch mode.
Table 26. SDOResultSet methods that support Batch mode
void cancelBatch() [Extension]
Undoes all the modifications of the current batch.
void sendBatch() [Extension]
Sends the current batch to the AppServer.
void sendBatchAndReOpen() [Extension]
Sends the current batch to the AppServer, then reopens the ResultSet. In Stateless mode, this method is more efficient than separately calling sendBatch() and reOpenQuery(). For more information, see Visibility of updates.
void startBatch() [Extension]
Starts a batch session. All the modifications (column updates, deletions and insertions) are maintained locally. Calling this method if you have already called it and have not called sendBatch() or cancelBatch() throws an Exception.
boolean inBatch() [Extension]
Returns true if the SDOResultSet object is in Batch mode (that is, you have called startBatch() and have not yet called sendBatch() or sendBatchandReopen()).
Note: A row that is updated or deleted in Batch mode, and has not yet been sent to the AppServer (using sendBatch()), cannot be refreshed using refreshRow(). Also, to save your changes locally in batch mode, you must still call the row update methods (for example, insertRow() or updateRow()) even though, in this mode, your changes are not sent to the AppServer.