What is Change Indicator property

Recently I was wondering, what is the Change Indicator property that we see in each entity’s attribute?

Change Indicator

In this post I will answer myself. ADF framework provides automatic “lost update” detection for entity objects to ensure that a user cannot unknowingly modify data that another user has updated and committed in the meantime. Typically, this check is performed by comparing the original values of each persistent entity attribute against the corresponding current column values in the database at the time the underlying row is locked. ADF framework checks for row changes as follow:

  1. When the entity cache is first populated, or whenever commit() is called, the framework saves a copy of the data as it is exist in the database. This copy is maintained even if the value in the cache is later changed.
  2. When the transaction attempts to acquire a lock, every attribute in the copy is compared with the corresponding table column. If any of these comparison fail, the frame work throws oracle.jbo.RowInconsistentException.

If you are attempting to acquire locks for many rows, and each row has a large number of column, this can be expensive operation. You can make the lost update detection more efficient by identifying any attributes of your entity whose values you know will be updated whenever the entity is modified. Typical candidates include a version number column or a set of attributes that you know will change every time any value in the row is changed. The change-indicator attribute’s value might be assigned by a database trigger you’ve written and refreshed in the entity object using the Refresh After Insert and Refresh After Update options (in the Edit Attribute dialog).When you use a change indicator, the framework only performs the comparison for attribute in the change indicator instead of for every entity attribute.

Advertisements

3 Comments

Filed under ADF

3 responses to “What is Change Indicator property

  1. Marco

    And, this is the Optimistic ans pessimistics AM’s option ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s