Navigating in a SyncResolver Object Setting the Resolved Value for a RowSet Data Synchronization Conflict

6-24 Oracle Fusion Middleware Programming JDBC for Oracle WebLogic Server without a conflict, the value in the SyncResolver is null. For values with a conflict, the value is the current value in the database.

6.12.4 Navigating in a SyncResolver Object

With a SyncResolver object, you can page through all conflicts and set the appropriate value for each conflict value. The SyncResolver interface includes the nextConflict and previousConflict methods that you can use to navigate directly to the next row in the SyncResolver that has a conflict value other than null. Because a SyncResolver object is a rowset, you can also use all of the rowset navigation methods to move the cursor to any row in the SyncResolver. However, the nextConflict and previousConflict methods enable you to easily skip rows that do not contain conflict values. After you move the cursor to a conflict row, you must check the value in each column with the getConflictValue method to find the values in the database that conflict with the values in the rowset, and then compare values to determine how to handle the conflict. For rows with values that do not conflict, the return value is null. If the row was deleted in the database, there is no value to return, so an exception is thrown. An example of code to compare values in the rowset and database: syncresolver.nextConflict for int i = 1; i = colCount; i++ { if syncresolver.getConflictValuei = null { rsValue = rs.getObjecti; resolverValue = syncresolver.getConflictValuei; . . . compare values in the rowset and SyncResolver to determine which should be the resolved value the value to persist } }

6.12.5 Setting the Resolved Value for a RowSet Data Synchronization Conflict

To set the appropriate value to persist in the database, you call setResolvedValue . For example: syncresolver.setResolvedValuei, resolvedValue; The setResolvedValue method makes the following changes: ■ Sets the value to persist in the database. That is, it sets the current value in the rowset. When changes are synchronized, the new value will be persisted to the database. ■ Changes the original value for the rowset data to the current value in the database. The original value was the value since the last synchronization. After calling setResolvedValue , the original value becomes the current value in the database. Note: In the WebLogic rowsets implementation, a value conflict occurs if any value in a row in the database differs from the values read into the rowset when the rowset was created or when it was last synchronized. Using RowSets with WebLogic Server 6-25 ■ Changes the WHERE clause in the synchronization call so that updates are made to appropriate rows in the database.

6.12.6 Synchronizing Changes