Posts

Showing posts from January, 2011

Globally setting the Row Fetch Limit for all ViewObjects

Image
There is an interesting feature available with 11gR1PS3(11.1.1.4.0) release which may help you to set a default 'row fetch limit' for all ViewObjects at application level. This is very useful to avoid expensive table scan if you don't have maxfetchsize defined for individual ViewObjects. Apparently, this 'global setting' fits well for those ViewObjects where each query execution may result in large number of records. Please note that, even the 'row count' query issued by the framework may also result in performance issues if the table is having huge chunks of data.

How do you set the 'Row Fetch Limit' globally?

This value can be configured using 'rowLimit' under <adf-adfm-config> section of <adf-config> file from your application.

<adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config"> <defaults useBindVarsForViewCriteriaLiterals="true" rowLimit="10000"/> ... </adf-adfm-config…

Marking an Entity Object as modified

There are use cases where developers may need to explicitly set the Entity Object state as modified so that it becomes 'dirty' and participate in the 'transaction commit' cycle. This scenario usually arise where you may have Entity Objects(not exposed through UI) whose attributes needs to be populated by the system as 'history columns' or through database trigger, when a transaction gets committed. Please note that only dirty entity instances participate in transaction post cycle. How to mark an entity instance as modified? Unfortunately, there is no public API available at EntityImpllevel to mark the instance as as modified (EntityImpl::setState() is a private method). A work around solution for this specific scenario is to brutally set one attribute of the EntityImpl instance with its current/original value.

//purely a work around,
//currentValue is same as someEntityImpl.getSomeAttribute()
someEntityImpl.setSomeAttribute(currentValue);

This action would …

Customizing the <af:query> component display by overriding CriteriaItemAttributeHints

Image
More granular control on the display of af:query is a much awaited feature by the ADF community. Good news is that, 11gR1(11.1.1.4.0)[ aka 11gR1PS3 ] release comes along with new API on ViewObjectImpl - public AttributeHints getCriteriaItemAttributeHints(ViewCriteriaItem vci) - which may help you to hook your custom logic to control the 'run time' display behavior of af:query built using ViewCriteria.

I'm sharing simple example built based on the above concept. This example would display 'DepartmentName' in a 'shortened field' when displayed inside the af:query whereas the same field would be displayed in the normal size when displayed out side of af:query.


A glance at the implementation

This example overrides the DepartmentsViewImpl::getCriteriaItemAttributeHints(ViewCriteriaItem vci) to return customized AttributeHints as shown in the following code snippet

/** * By default return null. Subclasses may override to return * custom AttributeHints implementatio…

Why does <tr:inputListOfValues> fail to show dialog when used with ADF Faces application?

Sometime back I noticed a couple of queries on the above topic, saying the <tr:inputListOfValues> fails to show the dialog when used inside a Fusion Web Application( application built on ADF stack ). The answer for this specific case is that, <tr:inputListOfValues> is not designed to work with ADF Controller. In other words, ADF Controller is not bothered about the Trinidad Dialog configuration. Ideally developers are not supposed to mix Trinidad pages built using 'Trinidad Dialog Framework' with ADF Faces pages.

Oracle JDeveloper and Oracle ADF 11g Release 1 Patch Set 3 is now available on OTN

Oracle JDeveloper and Oracle ADF 11g Release 1 Patch Set 3 (11.1.1.4.0) is available on OTN. Check it out

Editing multiple Attributes of View Object in a single go

Image
You can edit multiple attributes of Entity Object or View Object in a single shot by selecting them from Structure window and editing the values using the 'Property Inspector'.
1. Select Entity Object/View Object in the Project Window
2. 'Multi select' the attributes in the Structure Window by pressing Ctrl key followed by the attributes from the Entity Object or View Object
3. Modify the property of your interest using the Property Inspector window( Open this window if not already opened). This modification would get applied to all the selected attributes.

Declaratively setting the current row key in a ViewObject

Image
In this post I'm sharing simple example illustrating the declarative approach for overriding the default selected row of a ViewObject. Please take a look at the following screen shot, the row selection of the Department details displayed inside the 'paginated parameter form' changes in accordance with selection in the drop down list (displayed on the top of the screen). In other words, the row selection of a ViewObject for the parameter from changes in accordance with value from the drop down list.


A glance at the implementation

This example gets the row key of the currently selected item from selectOneChoice, and uses the same for setting the 'current row' for the ViewObject used for displaying parameter form in the task flow. Please note that, 'current row key' can be declaratively retrieved by making use of built in 'currentRowKeyString' method from iterator used for building the selectOneChoice. As I mentioned earlier, this key is passed as par…

Tips on defining Declarative View Objects

Image
View Objects in 'Declarative SQL Mode' would help you to optimize SELECT clause at run time by having only those attributes/columns really used by the page(based on the attribute definitions from the page definition file ). This feature is useful if you have large number of attributes and only a subset is displayed on the UI. Please refer 5.8 Working with View Objects in Declarative SQL Mode in Fusion Developer's Guide to learn more about Declarative View Objects.

Please note that, each attribute in the view object has a Boolean property called "IsSelected". This is shown in the attribute editor as a check box - "Selected in Query".


If IsSelected=true (or absence of IsSelected attribute), then that attribute will be selected in the SELECT statement always, regardless of whether the attribute is selected by the UI or not. So if you really want to have optimized SELECT clause generated at run time (based on the attribute usage on UI), please deselect &qu…

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.