Tuesday, December 22, 2009

Composition Association and Locking (Fixed in

We had a lot of locking problems in our ADF application even though we use optimistic locking.

We found out that it was caused by composition Association and Lock Top Level Container Option.
This is the default way the association is generated by the wizard when the foreign key constraint in database is cascade.
In my test case I set it by hand to reproduce in Department Employees relationship.

The master Entity Table in database is locked every time you create a new record in the detail composed entity.
This is happening when creating detail data and not when posting data as in optimistic locking
This does not happen when you update or delete data from detail entity.

Is this a bug?

If pessimistic mode of Application Module is not a good practice for Fusion Applications then composition Association Locking should also be not.

Composition Association is a rule to prevent details to exist without a master. But this is also prevented if the foreign key attribute in detail entity is required. So I also don’t see the usage of composition association.

Test Case:

Wednesday, December 16, 2009

GoMenuItem and GoLink with target="_Blank" don't work correctly inside a Menu

We have strange behavior with GoMenuItem and GoLink components inside menu items

To reproduce the problem i created the following simple test case:
Created a menu with 2 levels and gomenuItems and MenuLinks that all open 'otn' in new '_blank' window.

The menu is the following:

1. In the menu above if i select goMenuItem 1 then new window opens behind my window (internet explorer 7,) works correctly in mozilla. goMenuItem 2 works correctly in ie7 also.

Funny thing is that if in ie7 you have a second tab opened then it works correctly.

2. goLink 1 works correctly, goLink 2 does nothing.

Is this a bug? any workaround?

test case:

Monday, December 14, 2009

Pending changes in ADF application

So far I have seen 2 ways to check if there are pending changes in ADF application

1 is from ApplicationModule.getDBTransaction().isDirty();

2. is from DataControlFrame.isTransactionDirty();

Yet their functionality is not the same.
To demonstrate it I created a master –Detail, Departments - Employees test case with backing bean that return :

public String getAmChangesExist() {
BindingContext bc = BindingContext.getCurrent();
ApplicationModule am = bc.getDefaultDataControl().getApplicationModule();
return am.getTransaction().isDirty()?"True":"false";

public String getDcFramechangesExist() {
BindingContext bc = BindingContext.getCurrent();
String currentDataControlFrame = bc.getCurrentDataControlFrame();
return bc.findDataControlFrame(currentDataControlFrame).isTransactionDirty()?"True":"false";

If I change anything on department(except TransientAttribute) or employees and press submit then both methods show there are pending changes.

Yet if I change value of transient attribute only dataControlFrame.isTransactionDirty() shows there is a change, and am.getTransaction().isDirty() shows false

If I press button createInsert on Department or on Employees then again :
dataControlFrame.isTransactionDirty() shows there is a change, and am.getTransaction().isDirty() shows false
I feel that changes should not include transient attributes that dont exist in entities, since they are not used in transaction.
But it should include new rows created on views and entities.
In order to be sure i would chose dataControlFrame.isTransactionDirty() since it also keeps its value even with diferent application modules through task flows with shared data control scope.
Test case:

Sunday, December 6, 2009

Dynamic Region UIShell

I had created a Dynamic Region Template before the release of new jdeveloper patch.
Since there is a lot of discussion about the new Oracle UI Shell I decided to share it as I feel it is:
  • Simpler
  • Easier to use
  • Uses Dynamic Regions to navigate to different task flows
  • Provides customized functionality about navigating while having pending changes
  • Supports security permission check for navigating between task flows
The source code of the DynamicUIShell is here.

I also created a demo application based on HR schema, that uses this template to show the functionality. http://adfbugs.googlecode.com/files/TestDynamicUIShell.zip

In this demo you can run test page and see the functionality.
You can navigate between Home, employees and departments task flows.

If you make a change and try to navigate to an other task flow a popup raises and rollback if you chose continue.

If you try to navigate to Secured task flow a popup inform you that you don't have permission.

How to use Dynamic Region UIShell

Just import the jar file in your view controller project.

Then when you create a new JSF page you can select the template 'DynamicUIShell'.

Now you have the page based on the template.

First thing needed is to define the DefaultRegion , the task flow to be rendered in main area when the page is loaded.

i.e. f:attribute name="DefaultRegion" value="HomeTaskFlow"
Now the page should be functional and display the DefaultRegion task Flow.

Adding navigation components.

You can add now navigation components in facets like Global, TopMenubar, LeftToolBar.
Navigation components can navigate to other pages or display a different Task Flow in the main area.
In order for navigation components to be functional 2 properties are needed:
ActionListener should call navigate method of dynamicRegion managed bean (that exist in library).
Id of the component must be the path and name of task flow inside WEB-INF (with / character replaced with _):

Adding pending changes popup.

In order for pending changes to be checked a popup is needed to be added to your page, with your custom message and a Continue button.
The popup must be binded to dynamicRegion managed bean changesExist popup
The Continue button must have actionListener to dynamicRegion managed bean method continueNavigation method.
If you want to Rollback before navigation the Rollback action must exist in page definition.

Adding no permission popup

In order to check permission (taskFlowViewable) you need to add a popup on your page binded to noPermissionPopup of dynamicRegion managed bean.

Also when security is enabled in your application don't forget to allow access also to the template. To see the template in your jazn-data you need to select 'Show web pages imported from ADF libraries' check box.

Any feedback is usefull.

Monday, November 30, 2009

Issues after migrating our application from jdeveloper to

1. In windows XP pro, when the integrated weblogic is running we get the following exception about adrci.exe . Yet after that everything seems to be working ok.

2. We call many task Flows by url, in order to open them in new window. After migration they gave 403 error.

There is a new property added in Task Flows definition URL invoke that we needed to set it to url-invoke-allowed in all task flows called like that.

The only documentation I found about that is in

15.6.4 How to Call a Bounded Task Flow Using a URL

…The default value (calculated) allows a URL to invoke the bounded task flow if the bounded task flow does not specify an initializer and it has a view activity as its default activity. If the bounded task flow does not meet these conditions, a HTTP 403 status code is returned…

Yet even though we had no initializer and we had default activity we still got HTTP 403 and had to change to url-invoke-allowed

3. We have many tables that have check box based on a view object Boolean attribute. After migration the attribute value was always set to null no matter checked or unchecked.

The workaround was to remove in view objects from those attributes the control type ‘check box’ as Tilemahos in oracle forums found


Test case

Saturday, November 28, 2009

ActionListener and showPopupBehavior

Many times developers complain that actionListener of a button is not invocked when they add a showPopupBehavior. Yet that is not a bug.

By default showPopupBehavior the action type is Action that is a client event and does not invoke server actions. That is described in af:showPopupBehavior documentation:

The af:showPopupBehavior tag is a declarative way to show a af:popup in response to a client-side event. The client event is specified using the triggerType attribute. The "action" event is the default triggerType if one is not provided.

All actionListener method bindings and associated action listeners will not be invoked when the triggerType of "action" is used.

So the solution is to just set the triggerType of ShowPopupBehavior to click.

Then the actionListener and popup are invoked.

Edit 19/12/12:
As posted in the comments bellow, this is not the best possible workaround. It is more like a quick and dirty solution. With this solution even if the button is disabled the popup is still opened without the Action listener invoked.
A better solution if you need an action listener on buttons that opens a popup is not to use the showPopupBehavior but to open the popup from within the action listener by binding the popup to the managed bean and use popup.show() method.

Tuesday, November 24, 2009

Setting value programmatically on required field.

It is common requirement when you set a value in one field to also set a value to a second field.

This we usually do on setter of view object of the first field or the valueChangeListener also by adding a partialTrigger on the second field.

Yet if the second field is required and the previous value is null then nor the setter nor the valueChangeListener are invoked because of validation error.

This is because the partialTrigger is trying to refresh the second field before even submitting the first field.

Is this a bug or intended behavior?

The workaround we found is to remove partial trigger from second field and on valueChangeListener of the first field to use addPartialTarget

In the test case when you select department we want to set manager also, so in the setter of department id there is:
public void setDepartmentId(Number value) {
setAttributeInternal(DEPARTMENTID, value);
this.setManagerId(new Number(100));

Also managerId field is set required=true

Test case:

Sunday, November 22, 2009

Carousel does not make the selected row current

Carousel is a realy nice new component in jdeveloper 11 patch1
When you create a data binded carousel item it just uses an iterator and a tree model as a table.
Every item in carusel is from a diferent row of the iterator.
Yet when you select a new item the current row of the iterator is not changed.
So if you want to have other fields of the same iterator in the page or detail view objects iterators the data are not refreshed while navigating in Carousel.
I think a selectionListener as in the table component is missing.

In order to achieve the above behaviour i did the following:
I binded carouselSpinListener property to a backing bean method where
i get the carusel event NewItemKey and i find the Key of the row and i set iterator current row to the carusel selected row.
public void caruselSpin(CarouselSpinEvent event) {
List l =(List)event.getNewItemKey();
Key k = (Key)l.get(0);
DCIteratorBinding iter = getDCBindingContainer .findIteratorBinding ("DepartmentsView1Iterator");


Now Every time you select new item in carusel the iterator has the selected row.

Test case:

Sunday, November 15, 2009

Still reproduced bugs in jdeveloper patch 1

Yet there are still a lot of bugs that can reproduced in jdeveloper

Those bugs are:

Attribute Validation on Input List of Values attribute

Page Fragment Design view is messed up when using resource bundle

Workaround for Page Fragment Design view when using resource bundle

Number precision and scale bug

unexpected error on graph preview when security enabled

Tab selection and Enable User Customization on Session bug.

Unsaved changes uncommittedDataWarning bug

ExecuteEmptyRowSet and Range Paging.

LOV execute query many times ***Improved but not fixed

Range Paging in Master Detail bug.

Table Filter Bug

Af:Query bind variable bug

LOV view object Tuning: 'Only up to row number' bug

Returning from dialog to a page that has f:verbatim tag bug

Range paging and Table Selected Row Bugs
*** even though related metalink bug 8673654 is marked as fixed for this version

Partial Page Rendering ChangeEventPolicy="ppr" bug.

Performance Tuning, LOVs and Range Paging bug
*** now LOV with Range paging opens but when you return value you get exception.

ADF input list of values AutoSubmit bug.

Query Component Required Criterion bug ( r1 Bug)

Query Component Focus bug

Fixed bugs in jdeveloper patch 1

So i tried to reproduce bugs posted in this blog to the new patch 1 of jdeveloper 11.

Many on them are not reproduced any more and i consider them fixed.

Fixed bugs are:

Returning Multiple values from LOV in af:query with bind variables bug

No inconsistency check after any Exception during posting data

Af:Query bind variable bug

Region and dialog return bug

Page with Region Validations bug

LOV criteria bug.

Table Validations Bug.

Jdeveloper 11 r1 An unexpected severe error has ocurred in Jdeveloper

LOVs Dont return Values when there is any validation error on page

JDeveloper 11 r1 Cascading LOV bugs

Query Component Save bug

Query Component validations bug

Friday, November 13, 2009

New Feature Closing a Popup can now be captured.

My first impression of patch 1 of jdeveloper11 is that it looks like a new IDE,
diferent screens for overview and for security,
diferent menus and lots of new properties.

One thing that was missing and I was complaining about in the oracle forums was the capturing of an event when a popup dialog is closed.

Now a new property in popup component popupCanceledListener solves this problem.

You can just assign a backing bean method on it and it works no mater how you close the popup (with Cancel, with 'x' button or with ESC key).

This was realy needed. Thanks oracle team for the new feature

The only little bug in this is that in design view the popup is not visible when you place it in button facet popup

Test Case

Wednesday, November 11, 2009

Patch set 1 of Oracle JDeveloper 11g is now available

Oracle JDeveloper 11g ( (Build 5536) is now available for download at

I will try to reproduce all bugs posted until now in this blog and will log the results shortly.

Tuesday, November 10, 2009

returnListener from dialog page not invoke when pressing x button

In a button that opens an other page as dialog if you define a returnListener method in managed bean then when you return form dialog page by a button that has af:returnActionListener then it works fine.

But if you close the dialog page with explorer x button then return listener is not invoked!

i also noticed a worning in log:

WARNING: The application is running with the new window detect flag off. It is highly recommended that this flag be turned on to ensure proper functioning of your application when new browser windows are launched. In web.xml set the context parameter oracle.adf.view.rich.newWindowDetect.OPTIONS to 'on'.

But even when i did that there was no difference appart from no worning.

Is this a bug?

How can we ensure that when a dialog closes (no matter how) a method will be executed?

Test case:

Friday, November 6, 2009

Attribute Validation on Input List of Values attribute

If you have an attribute validation in an Entity Attribute that is used in a view object as Input List of values then validation does not work correctly.

For testing i added a simple validation in departmentId of Employees Entity that it should be less than 100:

I set departmentId as Input List of values and autosubmit.
When I run the page and i select an invalid department then the value is not set to the field and i have no validation Error

So in the page it looks that nothing have changed. But if i submit the page, the invalid value appears in department and the error message also.

So is this a bug?

The workaround we are using is to filter LOV to show only valid values to select, or to override the setter of the entity, which i do not consider as a good practice.

test case:

Tuesday, November 3, 2009

Returning Multiple values from LOV in af:query with bind variables bug

We get nullPointerException when returning multiple values from LOV in view criteria with bind variables.

To reproduce it in EmployeesView for departmentId I added LOV that also return ManagerId.

It work fine for Forms (TestForm) and for tables(TestTable), but not for af:query with bind variables:

I created 2 view criteria with departmentId and ManagerId, 1 with bind variables and 1 with no bind variables. And 2 pages 1 for each
TestQuery1 with af:query with bind variables
TestQuery with af:query with no bind variables

When trying to select department in TestQuery1 we get:

Caused by: java.lang.NullPointerException
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfCriterionValues.(FacesCtrlSearchBinding.java:2834)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfAttributeCriterion.(FacesCtrlSearchBinding.java:1732)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion._loadCriterionList(FacesCtrlSearchBinding.java:2775)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion._loadCriterionList(FacesCtrlSearchBinding.java:2725)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$AdfConjunctionCriterion.getCriterionList(FacesCtrlSearchBinding.java:2633)
at sun.reflect.GeneratedMethodAccessor840.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

Yet TestQuery return correctly departmentId and ManagerId.

So I guess the workaround is not to use bind variables in view criteria.

Test Case

Sunday, November 1, 2009

Workaround for Page Fragment Design view when using resource bundle

Since the layout of the fragments i am working on was messed up due to bug:

I was working on the structure view and i noticed the following worning:

So i thought what will happen if i move c:set deeper inside the tree:

And then the Design view is back to normal! and no problems at runtime also.
Note: It must be above all components that use c:set.

Sunday, October 25, 2009

Page Fragment Design view is messed up when using resource bundle

Design view of pages in jdeveloper is very usefull to find and layout components.

Yet in page fragments the Design layout is messed up when you use resource bundle for texts.

In the test case i created a simple page fragment with oracle default template and added 2 panel boxes:

but if i try to Select Text Resourse for Panel Box Title, the design view of the fragment is messed up.

You cant work any more in design view.
When you run application it looks ok, but not having a design view in fragments is quite a problem.
If i remove c:set component from the fragment then the Design view is fixed, but the text from bundles does not show in run time.
Is this a bug?

Test case:

Tuesday, October 20, 2009

How to check and throw exception after all data are posted

Thanks to Oracle Suport and Didier Laurent a workaround is found to problem:


By Design optimistick locking locks before doCommit.

In order to remove locks and not loose entities data and to restore entity states, set the configuration parameter jbo.txn.handleafterpostexc to true.

Thanks Didier and Oracle Suport.

Test case:

Saturday, October 17, 2009

Number precision and scale bug

Milos showed me this bug the other day and I could not believe it.

Number precision and scale does not work correctly in default ADF input field.

I searched metalink, I could not find something relevant

I reproduced it in a simple test case with Employees view object.

Employees Table has Salary field which is NUMBER(8,2) and CommissionPct NUMBER(2,2)
I also added a field on Employees table TO_PAY which is NUMBER(20,5)
I created a default input form.

When I try to enter value 123456.78 to salary which is a valid value I could not enter 8 digit
When I try to enter value 0.12 to CommissionPct I could not enter either 1 or 2 digit
When I try to enter value -123456789012345.12345 to ToPay field I could not enter the last 2 fields.

This issue is because when you drag and drop items on page it set precision the precision of the number ignoring fragment separator, sign symbol or 0 before fragment separator.

This is defined in input field property: maximumLength="#{bindings.Salary.hints.precision}"

You can eather remove maximumLength or set it to "#{bindings.Salary.hints.precision+1}" for Salary or +2 for percentages or even +3 for cases that you have only fragment digits like CommissionPct but you could also put negative number.
Take also into account that in some locale the negative number may have (###) format, meaning that you need +4 on maximumLength.

Also the number converter does not work correctly for numbers with more than 3 digits.
I tried to put 12345.12345 in ToPay field but when I submit I get back 12345.123 loosing the last 2 digits.

I try to fix this by setting ToPay converter min and maxFractionDigits
af:convertNumber groupingUsed="false"
minFractionDigits="5" maxFractionDigits="5"

then I could enter, see and submit all 5 fraction digits.

But when I try on an empty field to put number 123456789012345.12345 it is automatically converted to 123456789012345.12000 when I press tub. When I change it again it works ok.

Are these bugs?

Test case:

Tuesday, October 13, 2009

No inconsistency check after any Exception during posting data

During working on previous bug I found out that after any exception while posting Entity Data, inconsistency is not checked again.

Normally if 2 users query same row and change it then the user that commits last will get RowInconsistentException (JBO-25014)

But if second user get any exception while posting i.e. Foreign Key constraint exception, and then he correct it and commit again then he never gets a RowInconsistentException (JBO-25014)

To reproduce it in test case do the following

Run application and for ManagerId of department put an number that does not exist. Try to commit and you get constraint exception.

Open new instance of application and change anything and commit.

Go back to the first application correct the ManagerId to a valid value and commit.
You don’t get any RowInconsistentException

Is this a bug?

test case:

Friday, October 9, 2009

Open Locks in optimistic locking bug !!!

Open Locks in optimistic locking bug !!!

Yes it is possible, it was happening in our application and could not imagine why.
After research we found out that it was in the CustomDBTransactionImpl.
We use it to override doCommit in order to do staff after all data are posted but not yet committed according to :
Fusion Developer's Guide for Oracle ADF, D ADF Equivalents of Common Oracle Forms Triggers:

Execute code after Forms has "posted" all necessary rows to the database, but before issuing the data commit to end the transaction

If you want a single block of code for the whole transaction, you can override the doCommit() method in a custom DBTransactionImpl object and write code before calling the super.

I managed to reproduce it in a simple test case.

I just have Departments entity and view and an application module with CustomDatabaseTransactionFactory. In CustomDBTransactionImpl I override doCommit and throw an exception:

protected void doCommit() {
if (true){
throw new JboException("Exception in doCommit");

I run the application, make a change and press commit. I get the error:

Now the row is locked in the database!!!!

I run a new instance of the application i make a change and try to commit and I get:

If I try to do rollback before I throw the exception then the locks are lost of course but also all the changes made on page.

Is this a bug?
If not, is there an other way to check and throw exception, after data are posted to database and before commit, without locking?

Monday, October 5, 2009

unexpected error on graph preview when security enabled

I was trying to create graphs in a demo application with good results.
Jdeveloper 11 graphs are realy cool
Yet when i tried to put 1 in my application i got the known following error everytime i tried to preview graph in graph wisard.

i thought it was the selected data but, when i run application it seems ok

When i look at the messages tab of jdeveloper i see:

Caused by: oracle.security.idm.IMException: oracle.security.jps.JpsRuntimeException: The realm jazn.com does not exist. at oracle.security.jps.internal.idstore.xml.idm.IdmXmlIdentityStoreFactory.createIdmXmlIdentityStore(IdmXmlIdentityStoreFactory.java:182) at oracle.security.jps.internal.idstore.xml.idm.IdmXmlIdentityStoreFactory.createDefaultIdentityStore(IdmXmlIdentityStoreFactory.java:405) at oracle.security.jps.internal.idstore.xml.idm.IdmXmlIdentityStoreFactory.getIdentityStoreInstance(IdmXmlIdentityStoreFactory.java:196) at oracle.security.jps.internal.idstore.AbstractIdmIdentityStore.initStore(AbstractIdmIdentityStore.java:119) ... 60 more

So it had to do with security.

I enabled security in demo application and i have the same error again when i try to preview any graph from the wisard.

Is this a bug?

Test case:


user: tester

psw: welcome1

Tuesday, September 29, 2009

Tab selection and Enable User Customization on Session bug.

When you have enabled User Customization for duration of session then what ever user changes on a page it remains the same through out the session, ie. Disclosed panel boxes, advanced query criteria, visible columns of tables in panel collections etc.

The problem is that you cant customize which properties to be kept or not :
Fusion Developer's Guide for Oracle ADF & 34.3 Configuring User Customizations:
If you've enabled just session persistence, then all attribute values shown in Table 34-1 will be persisted to the session. There is no way to override this either globally or on an instance.

The bigger problem is that if you have some business logic about these components appearance or behavior you can’t override user settings.

We usually have some business logic about Disclosed tab in af:panelTabbed so I created this test case.

It’s a simple page that when you enter first tab should be disclosed and when you press button ‘Select Second tab’ second tab should be disclosed.

So I set disclosed property of First tab disclosed. Also on value change listener of button I run the following backing bean method:
public void SelectSecondTab(ActionEvent actionEvent) {

This work fine when I don’t have enabled User Customization.

But when I have enabled User Customization for duration of session then page always open with disclosed tab the one that I had selected the last time I used the page and backing bean method does not select the second tab.

Is this a bug?

Shouldn’t business logic methods override user customization settings?

Test case:

Wednesday, September 16, 2009

Range Paging and Restore Current Row After Rollback workaround

We use Steve Muench example for restoring current row after rollback is executed.
It was working fine until we started using Range Paging on view objects.
In view objects with range paging, if you select a row in the first page of range then rollback keeps the same row.

But if you select a row that is not on the first page of range, rollback gets you to the first row or throw a null pointer exception.

Reviewing the code of afterRollback method

public void afterRollback(TransactionEvent TransactionEvent) {
if (currentRowKey != null) {
Key k = new Key(currentRowKey.getAttributeValues());
Row[] found = findByKey(k, 1);

I noticed that it was calling executeQuery() method. I moved that call tbefore the findByKey method, and then rollback restores the current row after rollback even for view objects with Range Paging :

public void afterRollback(TransactionEvent TransactionEvent) {
if (currentRowKey != null) {
Key k = new Key(currentRowKey.getAttributeValues());
Row[] found = findByKey(k, 1);

Is this magic?

Do I miss something? Or it should be like that?

test case:

Wednesday, September 9, 2009

Unsaved changes uncommittedDataWarning bug

I was reading JDeveloper 11g — Functional Patterns & Best Practices for unsaved changes
and decided to try it.

I created 2 task flows and 2 pages and navigation between them, normal and as dialog
In both pages i set and i run application.
I make a change in department name and press Employees Dialog.
The warning message for changes apear.

But the Employees Doesn't open as dialog!!??
When i try to return to Departments i get again the warning, even though no changes in this page and its a different task flow
So with this feature
you cannot use dialogs,
it does not rollback data
it does not depend on page or on task flow.
you cannot change the message
you cannot add custom logic on it
The only good thing about this feature is that the warning shows also when you try to close the explorer window. I wish it was working only then and it also released the application module.
test case: