Friday, December 26, 2008

Bug in ADF Task Flow and ADF Query Component Combination

In our project, we have faced interesting bug, I will describe it in this post. This bug is related to three elements - ADF Query Component, ADF Task Flow and Page Definition. Basically speaking, we have two pages in our application, when opening second page from first and closing it - first page wasn't rendered correctly. At first, we were thinking something wrong with our Close button in second page - however after investigation we didn't found anything wrong with it. After all, we did some crazy tests and found the reason of a problem we were facing.

Problem description:
  1. Application contains two ADF Task Flows. Both ADF Task Flows are with Data Control Scope set to Isolated. First ADF Task Flow implements call to second, second returns back to first using Task Flow Return activity
  2. First ADF Task Flow contains JSF page with ADF Query component. ADF Query component property Disclosed is set to True
  3. Second ADF Task Flow contains basic JSF page with Close button. This page must have associated Page Definition file
To reproduce:
  1. From first page with ADF Query, open second page. Press Close button - you will return to first page. Repeat same action couple of times, while returning to first page you will get incorrectly rendered screen
We have spent quite a lot of time in order to understood the reason for this problem. Finally, we have noticed, problem gone when Page Definition for a page contained in second ADF Task Flow was removed. That sounds really strange, but it works like this. However, later I understood, main reason is ADF Query component. For some reason, this component is rendered in wrong way, when returning from ADF Task Flow with Data Control Scope set to Isolated.

Workarounds:
  1. Set Disclosed property to False for ADF Query component. This means, ADF Query will not be rendered when page will be opened and error will not appear
  2. For second ADF Task Flow, set Data Control Scope to Shared. Yes, this works well. For some reason, when second ADF Task Flow is using same data control instance as a first one - ADF Query component is rendered correctly. It works even with Disclosed set to True.
I personally, would like to recommend second approach, if you are not managing transactions.

You can download sample application, where you can reproduce described bug - ADFBugTaskFlowQuery.zip.

Sample contains first ADF Task Flow from where second is called:


Second ADF Task Flow contains Task Flow Return activity:


Data Control Scope is set to Isolated:


On runtime, when first ADF Task Flow is opened:


Press Job List button, second ADF Task Flow will be opened:


Press Close button, if you will not get error from first time, repeat same steps for 5-6 times and you will get it:


Page is rendered incorrectly and error is generated:


This error, is system error related to ADF Query criteria.

When Data Control Scope for second ADF Task Flow is set to Shared, it works well.

Spanish Summary:

Titulo: Bugs en el uso combinado de ADF Task flow and ADF Query Component.

Resumen: En este articulo, Andrejus muestra otro bug que tiene la herramienta, la cual se produce cuando se utiliza varios ADF Task Flow que muestra los mismos resultados basados en una consulta de datos. La soluciĆ³n finalmente radica en que ambos task flow compartan el mismo DataControl.

3 comments:

Chandu Bhavsar said...

Andrejus, I didn't see any comments on this yet. Don't know if you actually raised an SR/bug about this, and if there was communication regarding this offline. But for whatever it is worth, I ran your application in a later 11g build and couldn't reproduce it after trying repeatedly. (Tried ~ 20 times, as opposed to 5-6 times you mentioned.) So most likely, the build you were using had this as a transient bug which got fixed.

Andrej Baranovskij said...

Hi Chandu,

This bug is reproduced in current build available to download from OTN (Build 5188). Registered bug #8260652. However, as JDeveloper Product Management communicated to me, this bug is not reproduced in newest Oracle internal build.

Regards,
Andrejus

Anonymous said...

Andrejus, my question is regarding "Data Control Scope":
My master table is in a region (a.jsff) and my detailed table is in a task flow with Data-Control-Scope: shared which is a region inside a.jsff.
I want with one save button which is in a.jsff to save both changes from master and detail table. Update works fine, so saves changes from both tables. Perfect.
But I want deletion from the detail table (Delete button inside nested region) to be isolated. So that Delete button supposed to delete detail-table records and to commit in database, but not to commit changes in a master table.
Is this possible and how?
Shared-update with one save button (in a a.jsff), but isolated delete for the child records.?
Your advice is much appreciated.
Vesna