VERIFY_AUTO_VERSION_COLUMNS VERIFY_VERSION_COLUMNS Optimistic Concurrency Control Limitations

Using RowSets with WebLogic Server 6-29

6.17.4 VERIFY_NONE

The VERIFY_NONE policy only includes the primary key columns in the WHERE clause. It does not provide any additional verification on the database data. In our example update, the rowset issues: UPDATE employees SET e_salary = 20000 WHERE e_id = 1

6.17.5 VERIFY_AUTO_VERSION_COLUMNS

The VERIFY_AUTO_VERSION_COLUMNS includes the primary key columns as well as a separate version column that you specify in the WHERE clause. The rowset will also automatically increment the version column as part of the update. This version column must be an integer type. The database schema must be updated to include a separate version column e_version. Assume for our example this column currently has a value of 1. metaData.setOptimisticPolicyWLRowSetMetaData. VERIFY_AUTO_VERSION_COLUMNS; metaData.setAutoVersionColumne_version, true; metaData.acceptChanges; In our example update, the rowset issues: UPDATE employees SET e_salary = 20000, e_version = 2 WHERE e_id = 1 AND e_version = 1 The e_version column is automatically incremented in the SET clause. The WHERE clause verified the primary key column and the version column.

6.17.6 VERIFY_VERSION_COLUMNS

The VERIFY_VERSION_COLUMNS has the rowset check the primary key columns as well as a separate version column. The rowset does not increment the version column as part of the update. The database schema must be updated to include a separate version column e_version. Assume for our example this column currently has a value of 1. metaData.setOptimisticPolicyWLRowSetMetaData.VERIFY_VERSION_COLUMNS; metaData.setVersionColumne_version, true; metaData.acceptChanges; In our example update, the rowset issues: UPDATE employees SET e_salary = 20000 WHERE e_id = 1 AND e_version = 1 The WHERE clause verifies the primary key column and the version column. The rowset does not increment the version column so this must be handled by the database. Some databases provide automatic version columns that increment when the row is updated. It is also possible to use a database trigger to handle this type of update.

6.17.7 Optimistic Concurrency Control Limitations

The Optimistic policies only verify UPDATE and DELETE statements against the row they are changing. Read-only rows are not verified against the database. 6-30 Oracle Fusion Middleware Programming JDBC for Oracle WebLogic Server Most databases do not allow BLOB or CLOB columns in the WHERE clause so the rowset never verifies BLOB or CLOB columns. When multiple tables are included in the rowset, the rowset only verifies tables that have been updated.

6.17.8 Choosing an Optimistic Policy