Updated Example# 161 for Row Changed by Another User
By Steve Muench on Mar 13, 2013
I updated the sample application for my example #161, which illustrates how to ensure the "Row Changed by Another User" lost-update protection feature gives its warning even when AM pooling is disabled or the AM undergoes passivation/activation before encountering the row that another user has changed. I updated the sample to feature the standard "ADF Form" navigation buttons. When adding these navigation buttons, JDeveloper design time does the following:
- Marks the ChangeEventPolicy property of the iterator binding in the related page definition to have the value "ppr" in order that the iterator supports "Auto-PPR" functionality
- Creates the navigation <af:commandButtons> to have the partialSubmit="true" property
When clicking (Next) or (Previous), the partialSubmit="true" causes the page to undergo a partial page refresh rather than a full page request. On the web server, this translates then into a call to the related RowSetIterator's next() or previous() method to adjust the current row pointer in the row set iterator. The new current row has different values for the view row's fields than the previous row, and the ADFBC and ADFM data binding and ADF Faces framework layers cooperate when the ChangeEventPolicy="ppr" to automatically translate the change in current row and change in data value into appropriate additions of UI components to the ADF Faces partial target list. This ensures that during the HTTP roundtrip in which the row is navigated and/or the field values are changed, that the partial page request response returned with the same HTTP response includes the "delta" update instructions that the current ADF Faces JSF page needs to "surgically" refresh just certain elements in the page to update their values on the screen.
Previously the example's hidden field bound to the ObjectVersionNumber was using the <h:inputHidden> tag, which does not support the Auto-PPR behavior. This lead to its having the value of the ObjectVersionNumber of the original row displayed in the form when performing these partialSubmit="true" row navigations, as opposed to getting automatically updated to reflect the ObjectVersionNumber value of the current row being navigated to. This updated example changes the <h:inputHidden> to use the <tr:inputHidden> instead, which does support the Auto-PPR.
The side effect of having the <h:inputHidden>'s value staying "stale" was that upon row navigations, ADF Faces interpreted the value of the "stale" ObjectVersionNumber as an update to the navigated-to row's ObjectVersionNumber field, causing the row to get dirtied as if a user had modified a value in the row. The updated example works as you would expect.