Sunday, June 25, 2017

ADF BC Attribute - Collection Storage Mode Property

I would like to describe one interesting property for ADF BC attribute. This property is called Storage. There are two possible values: row (default) and collection. By default attribute value is saved in row storage, but alternatively it can be saved in collection storage. ADF BC implements collection storage using map which comes from session scope. This allows to keep value even between ADF BC requests, this is ideal for transient attributes.

Sample application (ADFBCCheckboxApp.zip) implements VO transient attribute to keep checkbox value:


VO is configured for Range Paging support. While user will navigate through UI table pages - VO range paging will re-execute and this will force VO replace rows (which will result in loosing transient attribute values):


This is how it will look like. User will select checkbox and then navigate to another table page:


After navigating back - checkbox value will be lost (range paging mode will re-execute VO rowset to bring rows belonging to current page):


To force transient attribute value to stay, go to Properties window for the attribute and scroll down to the last section. Select attribute called Storage:


Change value to collection. This will force ADF BC to store value for this attribute in session map:


Transient attribute value will stay, even when VO is re-executed in range paging mode and VO rowset is refetched:

7 comments:

Anonymous said...

Hi Andrejus,

This is really helpful topic. Thanks for sharing this info.

Regards,
Gijith.

Yazan said...

Thanks Anderjus for the valuable topic which is a very useful.

Kindly keep it up.

Andrej Baranovskij said...

Will do ! :) Thanks.

Andrejus

Sanjeeb Mahakul said...

Thanks for the update!! How about previous versions- ADF 11g ? Attributes does not have 'storage' property.

Andrej Baranovskij said...

I tested on 12c only.

Andrejus

Michael Shapira said...

My team member checked it. It does work, but only for transient attribute. For calculated doesn't work. Also if you are rewriting Oracle Forms and using createInstanceFromResultSet as an equivalent to POST-QUERY, note that if you set the check box in this createInstanceFromResultSet and later of the GUI you uncheck it, after executeQuery the uncheck will be gone

Andrej Baranovskij said...

Usually you dont need this approach for anything else than transient attribute. Calculated attribute value is always calculated and it doesnt require to hold temporary value.

createInstanceFromResultSet example is different use case and not directly related to the use case described with current sample.

I'm not saying it works in all possible scenarios, but is definitely good to know such option. In our specific requirement it worked perfectly. Sample code is posted.

Andrejus