Sunday, August 28, 2011

Cannot use a region in a page more than one time?

In our application we use regions for reusability and consistency.
For example we have An address region that we reuse in order to show and edit a person address and a company address. We pass the address owner as a parameter to the region in order to show corresponding data.

Yet if regions are placed in the same page then both regions show the same data even if they get different parameters.

This is because of automatic application modules nesting.
The framework see that AddressModule is already in data control and it use the same for both regions due to shared data control scope.

It does not happen if we don't use shared data control scope, yet then we have a different database connection for each region. It does not seems right to have different connection to get different data!!?

In the test case i have a simple Department Task flow that query for specific department depending on passed parameter inDepId


Then in a page i place the same region 2 times with different parameter passed in each region.
Yet when i run the application both regions show the same data.



Is there a way to show different data without having different database connection?

Test Case:

http://adfbugs.googlecode.com/files/TestRegions.rar

Tuesday, August 16, 2011

Rollback is executed when a region is refreshed

We are using Task flows as regions in jdeveloper 11.1.1.4 in the latest project.
I have just noticed that when a region refreshes then a data control transaction rollback is executed transparently.
This does not happen the first time the region is displayed but every time it is refreshed after that.
This cause unexpected behavior of loosing data and the current rows of any other shared transaction task flow.

Could this be an expected (designed) functionality? Why?

As a test case I have 2 application modules (DepartmentsModule and Employees module) and a page that has departments and a region that has Employees with ‘share transaction if possible’ in the EmployeesTaskFlow.
Also the EmployeesTaskFlow get as parameter the current DepartmentId and has Refresh condition ifNeeded so that it refresh every time I navigate into departments.

Yet when I press next button I loose any change made on current department and I stay in the same row.
What I see in log is that Rollback is executed as a consequence of region Refresh and releaseViewPort.



Is this expected behavior or a bug?

I will check also what happens in 11.1.2 that it seems the nesting implementation have changed:
http://one-size-doesnt-fit-all.blogspot.com/2011/08/task-flows-sayonara-auto-am-nesting-in.html

It reproduce also in 11.1.2

Test Case
http://adfbugs.googlecode.com/files/TestRegionRollback.zip

A Perfect explanation and solution is given by Oracle Support. I will put it as is here:
@ At the point when the customer decided the region should share the
@ transaction with its parent, he also made the region a potential actor on the
@ parent transaction. Since the transaction mode on the region is not 'Always
@ Use Existing Transaction', the region transaction is not necessarily created
@ by the parent (and I will come back to that later), the behavior of the
@ region becomes the behavior of the parent even if they don't share the same
@ datacontrol. That is because both datacontrol are in one transaction since
@ the transaction is shared. When the region refresh, it rollback the
@ transaction which rollback both datacontrol.
@ .
@ To make the share mode work, the main point the customer should pay attention
@ to is that the transaction should be created by the parent, not by the
@ region. If it is created by the region, then the region become the owner of
@ the transaction and will rollback when the region is refreshed. If the
@ transaction was created by the parent it will work as expected.
@ .
@ What you need to do is ensure that the transaction is owned by the parent.
@ You need to have it created before the region. They are several ways to do
@ that:
@ 1) Have the parent page in a bounded taskflow with 'Always Begin New
@ Transaction' mode on.
@ 2) Call beginTransaction() on the DataControlFrame in an action that
@ navigates to the parent page with the region.
@ 3) Have a method activity that executes beginTransaction() on a request bean
@ before navigating to the parent page with the region.
@ The code to do begin the transaction is:
@ .
@ public void beginTransaction()
@ {
@ BindingContext context = BindingContext.getCurrent();
@ .
@ String dcFrameName = context.getCurrentDataControlFrame();
@ DataControlFrame dcFrame = context.findDataControlFrame(dcFrameName);
@ dcFrame.beginTransaction(new TransactionProperties());
@ }
@ .
@ To prevent the region from owning the transaction and run into these types of
@ issue for share mode, you can set the transaction mode on the taskflow to:
@ or 'Always Use Existing Transaction' in the
@ property inspector. If the transaction does not exist, an exception is
@ thrown.
@ .
@ I modified the original test case to illustrate the different options. Open
@ the workspace and look at adfc-config.xml. Run the Start page, withoutTrans
@ is the original test case, withTrans and beginTrans are 2 options that work.
@ .


Resolution Test Case
http://adfbugs.googlecode.com/files/TestRegionRollback2.zip
Hello

Unfortunately it seems that the issue is not fully resolved.
This works until a Data control frame commit or Rollback is executed.
Then it seems that the parrent looses control again of the transaction and regions rollback again on every refresh...
In the test case i added 2 buttons that do :

DataControlFrame dcFrame = context.findDataControlFrame(dcFrameName);
dcFrame.commit();
and
DataControlFrame dcFrame = context.findDataControlFrame(dcFrameName);
dcFrame.rollback();

The test case work fine until any of the commit or rollback transaction is pressed
Then Next button still causes rollback to be executed.

This means that still i cannot control the full data control frame transaction when i have regions with parameters.

New test case
http://adfbugs.googlecode.com/files/TestRegionRollback3.zip

Sunday, June 26, 2011

Table Filter Number format bug

In a filterable table when we typed a number with decimals we got the following error:


It is an oracle database error that shows that the number entered in criteria is not converted correctly according to the locale of the database.
Same value in Search criteria works correctly.




So is this a bug?


Test case is on 11.1.2. It reproduce also in 11.1.1.4



I guess you need a database with different locale to reproduce (a locale that decimal ceparator is ',')

Tuesday, June 7, 2011

First jdeveloper 11.1.2 bug

For start let me say that i am impressed positively with the new jdeveloper development experience.
Fast and furious
Yet I hit on the first bug already.
I used the default oracle three column layout and created a jsf page with a panel box
On runtime when I tried to disclose first empty column I got a java script error




Is it a problem of old template?
Is it a problem of combination of jspx template with Facelet page?
Will see…
Test case
http://adfbugs.googlecode.com/files/Application5.rar

Major : Jdeveloper 11.1.2 release

Less than a month after the 'tricky' release of 11.1.1.5 the major release is here.
Not yet for SOA and Web Center.
Yet it is much earlier than i expected.
http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html
Lets hope it is the stable and promissing release we expected.
I have done over 10 migrations already of applications from TP1.
More than 3 every year, and it was a tricky task every time.
I am downloading at the moment.
Lets see...

Friday, May 27, 2011

Combo box does not remember values in table

When you define a List of Values in a View object as Combo Box with List Of Values there is an option to define ‘Most Recently Used Count’

Where you, enter the number of items to display in the choice list when you want to provide a shortcut to the end user to display their most recent selections.


This is quite useful functionality and it work fine when the field is used in a panel form layout.



Yet when it is used in table then it does not work, no matter how many times you select a value it does not remember the previously added values.




Is this a bug?


Test case:
http://adfbugs.googlecode.com/files/TestComboBox.zip



Still reproduce in jdeveloper 11.1.2

SR 3-3705906727 was posted for this.
Enchancement request that was created was rejected by Oracle development team.

=== ODM Answer ===

The MRUCount when the inputComboboxListOfValues is in a table won't work when ADF bindings are used:

The LOV bindings are created dynamically when used in a table and the "Most Recently Used Count" (MRU) feature is not enabled then.
MRU doesn't work in af:query too.

There is currently no plan to implement this feature in future releases.