By Abhishek Dwivedi on Jun 25, 2012
What is View Link Consistency?
When multiple instances (say VO1, VO2, VO3 etc) of an EO-based VO are based on the same underlying EO, a new row created in one of these VO instances (say VO1)can be automatically added (without re-query) to the row sets of the others (VO2, VO3 etc ). This capability is known as the view link consistency. This feature works for any VO for which it is enabled, regardless of whether they are involved in a view link or not.
What causes View Link inConsistency?
View Link Consistency for a VO could be disabled by disabling jbo.viewlink.consistent for the VO (or globally), or by applying setAssociationConsistent(false). Otherwise, any of the following can cause View Link inConsistency.
2. Unreferenced secondary EO
4. Using view link accessor row set
Why does this happen - View Link inConsistency? Well, there can be one of the following reasons.
a. In case of 1 & 2, the view link consistency flag is disabled on that view object.
b. As far as 3 is concerned, findByViewCriteria is used to retrieve a new row set to process programmatically without changing the contents of the default row set. In this case, unlike previous cases, the view link consistency flag is not disabled, meaning that the changes in the default row set would be reflected in the new row set.
However, the opposite doesn't hold true. For instance, if a row is deleted from this new row set, the corresponding row in the default row set does not get deleted. In one of my features, which involved deletion of row(s), I observed that my changes were not reflected on UI. To resolve this apparent "view link inconsistency" issue, I replaced findByViewCriteria by applyViewCriteria.
b. For 4, it's similar to 3 - whenever a view link accessor row set is retrieved, a new row set is created.
Now, creating new row set does not mean re-executing the query each time, only creating a new instance of a RowSet object with its default iterator reset to the "slot" before the first row. Also, please note that this new row set always originates from an internally created view object instance, not one you that added to the data model. This internal view object instance is created as needed and added with a system-defined name to the root application module.
Anyway, the very reason a distinct, internally-created view object instance is used is to guarantee that it remains unaffected by developer-related changes to their own view objects instances in the data model.