Thursday, August 7, 2014

Another cause of error (JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[x])

Note this bug happens when using JDeveloper 11.1.1.7, I didn't test it on 11g release 2 versions or 12c, but I assume it might happens as well.

Apparently there is another cause of "JBO-25014 user changed primary key error" other than the ones discussed in Chris Muir post (The_case_of_the_phantom) or Jobinesh post (what-you-may-need-to-know-about-nested). This is related when Passivation/Activation occur while the user is changing a record on Master view object that uses an entity and this entity has a reference usage in the detailed view object.

You can test this by setting Application Module pool off. Assuming the user want to change the hire date of the employee in the master form for specific employee, at the same time the hire date is being referenced in the detail job description table showing readOnly hire date field next to the employee job description (Using Entity reference of-course).

When the user changes the field and the field has autosubmit set on, Passivation/Activation process will happen at the stage, then the user hit the save/commit button, ADF will do another Passivation/Activation process. It will activate the (VOs) including field values (New submitted along with Original) as first step of execution, thus while trying to activate the DoDML method will fail and throw a JBO-25014 error. This because the system will go and check the Entity state if it Synced with the database table to find any mismatch in field values.

It will compare the original field value against the database value, the original field value which is Passivated was overwritten from the detail Entity reference when the first Passivation/Activation happens, thus comparing two different value ( which contains the new data after the first Passivation/Activation process) with the original database value which is not changed or touched at all, and then throwing JBO-25014 exception.

This is a bug in ADF that only happens when Passivation/Activation happens in the system and there is a circular dependency between Entities used in the same page. The workaround is use a inline sub-query inside the detail ViewObject rather than using Entity reference specially when you know that you will build a screen that will have that field 1- editable, 2- referenced at the same time in the same screen, and 3- there is a possibility that Passivation/Activation will occur at some stage.

I will address anther bugs in Passivation/Activation mechanism in the following posts that I already submitted SRs for, at Oracle Support.

No comments:

Post a Comment