Friday, March 28, 2014

ADF Tips and Tricks: SkipValidation for PageDef of Method Call Activity

When working on a method call activity in a task flow, JDeveloper creates a PageDef file for the operation called in the activity. For the root tag <pageDefinition> in this file, these is a special attribute SkipValidation, which determines whether data validation should occur for the activity.

In the case where the operation being called is, for example ADF Create, CreateInsert or CreateWithParams, the value of the attribute SkipValidation is true by default. If for some reason (for example manually editing the PageDef file), the attribute is missing, you will end up with exceptions rooted on some validation error if the newly created row has mandatory attributes.

Here's a code snippet as an example:


You can find more information from the section "A.8.1 PageDef.xml Syntax" in the documentation Developing Fusion Web Applications with Oracle Application Development Framework at:

Wednesday, March 19, 2014

ADF Tips and Tricks: Stretch the panelCollection and table component

When using the ADF panelCollection and table component, it's very common to wish a panelCollection component and its nested table component to stretch across the width to occupy all available space of the containing component.

To do this:

  1. Set the styleClass attribute of the panelCollection component to AFStretchWidth. This style will stretch the component to what appears to be 100% width of the parent container.
  2. Set the columnStretching attribute of the table component to an appropriate value other than the default value none, such as last.

You can find more information about the AFStretchWidth style class from the section "9.2.4 Tips for Using Geometry-Managed Components" in the documentation Developing Web User Interfaces with Oracle ADF Faces at:

In the same documentation, you can find more information about the columnStretching attribute from the section "12.3.4 How to Display a Table on a Page" at:

Tuesday, March 11, 2014

ADF: Unexpected validation, ChangeEventPolicy and immediate editable table

When using ADF editable table, you could come across annoying unexpected validation error messages. For example, when you CreateInsert a new row with some mandatory attributes in an editable table, without proper control, your could get validation error messages even before you type anything in the newly created row. It gets even worse when you try to change the current selection of rows, you will get more repeated validation error messages.

You can control this kind of strange behaviors of ADF editable table by setting the ChangeEventPolicy attribute of the iterator binding to none, and the immediate attribute of the table component to false.

Change Event Policy

You can find more information about the ChangeEventPolicy attribute from the section 27.2.1 What You May Need to Know About Partial Page Rendering and Iterator Bindings of the documentation Developing Fusion Web Applications with Oracle Application Development Framework at:

In the CreateInsert case, with the default value ppr set for the ChangeEventPolicy attribute of the iterator binding, when you try to create a new row by clicking the button bound to the CreateInsert operation, A POST request is sent to the server and a new row is inserted in the data model. The response for that request will instruct an automatic PPR request to be posted right after the CreateInsert request, even before ADF updates the table and render the UI components for the new row. It's this subsequent request causes the validation, which is too early.

When you disable the automatic PPR request by setting the ChangeEventPolicy attribute of the iterator binding to none (and setting the partialTriggers of the table component to the CreateInsert button, so that the button event will trigger the rendering of the table), the button and table will behave properly: a single request is posted when the button is clicked; a new row is inserted; the table component is updated with the UI components required for the new row, and these updates are sent back within the response and partially rendered in the page. 

Immediate Table Component

With a table component that supports selection, when the current selection changes, a selection event will be sent back to the server with a POST request. It's no surprise that all form fields in the table, are posted back together. It's this request that triggers the validation, in case the immediate attribute of the table component is set to the default value false

By setting the immediate attribute of the table component to true, validations of other components which are not immediate will be bypassed. In this way, we get rid of the unexpected validation, and leave it to later process, when the transaction is about to complete.

Monday, March 10, 2014

ADF: DBSequence attribute got an empty value for a new row

From the section "4.10.10 How to Get Trigger-Assigned Primary Key Values from a Database Sequence" in the documentation "Developing Fusion Web Applications with Oracle Application Development Framework" at:

We have the following description:
"When you create a new entity row whose primary key is a DBSequence, a unique negative number is assigned as its temporary value. This value acts as the primary key for the duration of the transaction in which it is created. "
But sometimes, for some reason, you could come across the problem that a DBSequence attribute remains empty for a new row. In my case, it happened to an entity newly created after I manually switched Data Type Map of the model project from Java Extended for Oracle to Java.

To fix this problem, you need make sure DefaultValue and Domain properties of the attribute are there as the following highlighted lines:


The domain object and the magic default value "@0" cause the view object to generate a negative number as the temporary key.

You can also find a discussion on this issue at:

Friday, March 7, 2014

ADF: Manually change Data Type Map for a BC project

After I worked on a new ADF project for a while, I decided to change the Data Type Map of my data model project from the default Java Extended for Oracle to Java.

As described in the section "How to Initialize the Data Model Project With a Database Connection" of the documentation "Developing Fusion Web Applications with Oracle Application Development Framework" at:

Once you save project selections in the Initialize Business Components Project dialog, the project is considered initialized. You will not be able to change the data type map of the initialized project and it is not recommended to change the SQL platform after you have created business components.

So, I looked for the configuration entries for the data type map across the project, and ended up with two files, "bc4j.xcfg" and ".jpx" file of the model project.

I made a change as follow, in the ".jpx" file:

-  <Attr Name="_jbo.TypeMapEntries" Value="OracleApps"/>
+  <Attr Name="_jbo.TypeMapEntries" Value="Java"/>

and changes in "bc4j.xcfg", for all application module configurations:

-  <Database jbo.locking.mode="optimistic" jbo.TypeMapEntries="OracleApps"/>
+  <Database jbo.locking.mode="optimistic" jbo.TypeMapEntries="Java"/>

This seems to work fine in my case. It's a small and simple model project anyway.