Monday 10 November 2014

Populating who columns-createdBy,creationDate,lastUpdatedBy,lastModifiedBy(attributes) in ADF

Hi All,

I would like to thank "John Stegeman"  for his wonderful information on how to populate who columns -
createdBy,creationDate,lastUpdatedBy,last ModifiedBy declaratively on OTN.

I have exactly copied what ever he suggested for my reference and hope that it may helps for ADF beginners as well.

If you need to keep track of historical information in your entity object, such as when an entity was created or modified and by whom, or the number of times the entity has been modified, you specify an attribute with the History Column option selected (in the Edit Attribute dialog).

If an attribute's data type is Number, String, or Date, and if it is not part of the primary key, then you can enable this property to have your entity automatically maintain the attribute's value for historical auditing. How the framework handles the attribute depends which type of history attribute you indicate:

* Created On: This attribute is populated with the time stamp of when the row was created. The time stamp is obtained from the database.
* Created By: The attribute is populated with the name of the user who created the row. The user name is obtained using the getUserPrincipalName() method on the Session object.
* Modified On: This attribute is populated with the time stamp whenever the row is updated/created.
* Modified By: This attribute is populated with the name of the user who creates or updates the row.
* Version Number: This attribute is populated with a long value that is incremented whenever a row is created or updated.
If you choose Version Number from the History Column drop-down list,Oracle ADF will automatically increment the value of the numeric attribute every time the object is updated.



Screen shot for reference from JDev version 11.1.1.6 and 11.1.2.4















Note : I was getting "oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key" error whenever i try to update any record 
Please refer below blog to find out exact reason for the issue
Reference blog
http://radio-weblogs.com/0118231/stories/2004/03/24/whyDoIGetOraclejborowinconsistentexception.html

In my case, i have resolved by checking tick mark for Change Indicator attribute for Id attribute(primary key) and it solves the error.


Change Indicator. This property defines specific attribute to be responsible for row data changes tracking, instead of checking every attribute. Only if Change Indicator attribute value will be changed in DB, then current row changes will be prevented and user will be informed about someone else changes in the same row.


No comments:

Post a Comment