RowSet Data Synchronization Conflict Types

6-22 Oracle Fusion Middleware Programming JDBC for Oracle WebLogic Server

6.12.1 RowSet Data Synchronization Conflict Types

Table 6–2 lists the types of conflict scenarios that can occur when synchronizing data changes from a rowset to the database. Table 6–2 Conflict Types When Synchronizing RowSet Changes in the Database RowSet Data Change Type Database Data Change Type Notes Update Update Values in the same row in the rowset and database have changed. The syncresolver status is SyncResolver.UPDATE_ROW_CONFLICT. Your application may need to supply logic to resolve the conflict or may need to present the new data to the user. Update Delete Values in the row in the rowset have been updated, but the row has been deleted in the database. The syncresolver status is SyncResolver.UPDATE_ROW_CONFLICT. Your application may need to supply logic to decide whether to leave the row as deleted as it is in the database or to restore the row and persist changes from the rowset. ■ To leave the row as deleted, revert the changes to the row in the rowset. ■ To restore the row with changes, insert a new row with the desired values. Note that if the row is deleted in the database, there is no conflict value. When you call getConflictValue, WebLogic Server throws a weblogic.jdbc.rowset.RowNotFoundException . Delete Update The row has been deleted in the rowset, but the row has been updated in the database. The syncresolver status is SyncResolver.DELETE_ROW_CONFLICT. Your application may need to supply logic to decide whether to delete the row as it is in the rowset or to keep the row and persist changes currently in the database. Note that in this scenario, all values in the row will be conflicted values. To keep the row with the current values in the database, call setResolvedValue to set the resolved value for each column in the row to the current value in the database. To proceed with the delete, call syncprovider.deleteRow . Delete Delete The row has been deleted in the rowset and has been deleted in the database by another process.The syncresolver status is SyncResolver.DELETE_ROW_ CONFLICT. To resolve the SyncProviderException, you must revert the delete operation on the row in the rowset. Note that there will be no conflict value not null, either for any column in the row. When you call getConflictValue , WebLogic Server throws a weblogic.jdbc.rowset.RowNotFoundException . Insert Insert If a row is inserted in the rowset and a row is inserted in the database, a primary key conflict may occur, in which case an SQL exception will be thrown. You cannot directly handle this conflict type using a SyncResolver because a SyncProviderException is not thrown. Using RowSets with WebLogic Server 6-23

6.12.2 SyncResolver Code Example