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: The realm does not exist. at at at at ... 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