Andrejus Baranovski
Multiple LOV's per Attribute in JDeveloper 11g
During OOW 2008 I have attended Steve Muench talk about new features in ADF Business Components available in 11g release - Oracle ADF: New Declarative Validation, LOV, Search, and Services Features. Those features will be available in Production release, announced to appear this month. However, Oracle ACE Directors already have access to production release candidate - JDeveloper 11g Release Candidate for ACE Directors, so I'm able to test those new features.
Very imporant new feature for me - possibility to define multiple LOV's per one attribute. Previously it was possible to have only one LOV defined in Model layer per attribute. In this post I will describe how it works, based on mentioned Steve Muench presentation, and will publish sample application I have developed - LOV_Multiple.zip. You will not be able to run this sample in TP4, only in production when it will be available (I hope very soon).
My sample is based on HR schema, it contains one main View object - EmployeesView and two read-only View objects for LOV's - DepartmentsView and DepartmentsEuropeView. Those two LOV's are based on different SQL statements:

With multiple LOV's per attribute feature, we can use now two or more View objects with different SQL statements for the same attribute. For example, basic SQL statment in DepartmentsView, returns all departments:

And SQL statment in DepartmentsEuropeView, returns departments only from Europe:

Here is a sample screen, where you can see multiple LOV's per attribute defined:

I have defined in this sample, two LOV's for DepartmentId attribute - LOV_Department and LOV_Department_Europe. There is List of Values Switcher attribute defined - lovAttr. This attribute returns LOV name to be used, I have created it as Transient attribute in Employees View object. In its getter method I'm doing a check - if current region is Europe I'm using LOV only with European departments, otherwise default LOV with all departments is used:

On runtime, if employee is based in European department - DepartmentId LOV will use DepartmentsEuropeView and will list only departments from Europe:

In other case, default LOV will be used with all available departments listed:

Very imporant new feature for me - possibility to define multiple LOV's per one attribute. Previously it was possible to have only one LOV defined in Model layer per attribute. In this post I will describe how it works, based on mentioned Steve Muench presentation, and will publish sample application I have developed - LOV_Multiple.zip. You will not be able to run this sample in TP4, only in production when it will be available (I hope very soon).
My sample is based on HR schema, it contains one main View object - EmployeesView and two read-only View objects for LOV's - DepartmentsView and DepartmentsEuropeView. Those two LOV's are based on different SQL statements:
With multiple LOV's per attribute feature, we can use now two or more View objects with different SQL statements for the same attribute. For example, basic SQL statment in DepartmentsView, returns all departments:
And SQL statment in DepartmentsEuropeView, returns departments only from Europe:
Here is a sample screen, where you can see multiple LOV's per attribute defined:
I have defined in this sample, two LOV's for DepartmentId attribute - LOV_Department and LOV_Department_Europe. There is List of Values Switcher attribute defined - lovAttr. This attribute returns LOV name to be used, I have created it as Transient attribute in Employees View object. In its getter method I'm doing a check - if current region is Europe I'm using LOV only with European departments, otherwise default LOV with all departments is used:
On runtime, if employee is based in European department - DepartmentId LOV will use DepartmentsEuropeView and will list only departments from Europe:
In other case, default LOV will be used with all available departments listed:
JDeveloper 11g Release Candidate for ACE Directors
During Oracle ACE Directors briefing in San Francisco on previous week, Duncan Mills gave JDeveloper 11g Release Candidate for ACE's to test. This build is very close to production they will deliver soon.
What I can say? I really like it, I can't stop testing it during recent days. And, I'm quite surprised in positive way - many bugs from previous builds are fixed, that's good news for us. Main new thing is BEA WebLogic server, its main server now and at least in ACE's build there is no embedded OC4J anymore. Actually, up to some degree I miss good old OC4J. But at the same time, it looks with WebLogic server, application deployment and execution became more stable. WebLogic brings some positive changes in the security area as well, you will see it soon.
One more thing, there will be installer now for JDeveloper. Its related to BEA WebLogic configuration. However, no worries for this, installation process is really quick - up to 5 minutes on my MacBook Pro machine.
Hope you will be able to enjoy JDeveloper 11g production soon.
What I can say? I really like it, I can't stop testing it during recent days. And, I'm quite surprised in positive way - many bugs from previous builds are fixed, that's good news for us. Main new thing is BEA WebLogic server, its main server now and at least in ACE's build there is no embedded OC4J anymore. Actually, up to some degree I miss good old OC4J. But at the same time, it looks with WebLogic server, application deployment and execution became more stable. WebLogic brings some positive changes in the security area as well, you will see it soon.
One more thing, there will be installer now for JDeveloper. Its related to BEA WebLogic configuration. However, no worries for this, installation process is really quick - up to 5 minutes on my MacBook Pro machine.
Hope you will be able to enjoy JDeveloper 11g production soon.
Second Session on UKOUG 2008 Conference
I already was accepted for UKOUG 2008 Conference with my paper - ADF Task Flow - Based On Practical JDeveloper 11g Experience.
However, during last week in San Francisco (Oracle OpenWorld), I got a phone call from UKOUG office and was invited to deliver second presentation on UKOUG 2008. They have asked to present similar session as I was doing on OpenWorld, Oracle Develop track - My Session at Oracle Open World 2008 (Oracle Develop). It is about Oracle Maps integration with ADF in JDeveloper 11g.
See you during UKOUG 2008, it will be really fun !
However, during last week in San Francisco (Oracle OpenWorld), I got a phone call from UKOUG office and was invited to deliver second presentation on UKOUG 2008. They have asked to present similar session as I was doing on OpenWorld, Oracle Develop track - My Session at Oracle Open World 2008 (Oracle Develop). It is about Oracle Maps integration with ADF in JDeveloper 11g.
See you during UKOUG 2008, it will be really fun !
JDeveloper/ADF News from Oracle OpenWorld 2008
This week I'm in San Francisco, attending Oracle OpenWorld 2008 conference.
One of the main news for me, announced on Ted Farrell keynote - Breaking Enterprise Application Platform Barriers, was a date of JDeveloper 11g production release - October 1. I already can start to play with it, Oracle provided private ACE Directors build on September 21.
Ted Farrell announced Oracle Developer Tools Strategy:

As you see, JDeveloper/ADF is Oracle's strategic tool and framework. Enterprise Pack for Eclipse is second strategic tool, designed for core Java developers.
On the same keynote, vision for Rich Enterprise Applications powered by ADF and WebCenter was defined:

In 11g, ADF becomes really rich framework, with support for WebCenter Services, View layer with JSF Core, Data Visualization, GeoMap and Data Manipulation. ADF can render View layer on different devices, in the future there will be support for iPhone as well.
I already did my session on Monday - My Session at Oracle Open World 2008 (Oracle Develop). It was attended very well, almost full room (60 people), and what is most important no errors in demo development. You can download application - OraMaps11_Session.zip, I have developed during my session:

One of the main news for me, announced on Ted Farrell keynote - Breaking Enterprise Application Platform Barriers, was a date of JDeveloper 11g production release - October 1. I already can start to play with it, Oracle provided private ACE Directors build on September 21.
Ted Farrell announced Oracle Developer Tools Strategy:
As you see, JDeveloper/ADF is Oracle's strategic tool and framework. Enterprise Pack for Eclipse is second strategic tool, designed for core Java developers.
On the same keynote, vision for Rich Enterprise Applications powered by ADF and WebCenter was defined:
In 11g, ADF becomes really rich framework, with support for WebCenter Services, View layer with JSF Core, Data Visualization, GeoMap and Data Manipulation. ADF can render View layer on different devices, in the future there will be support for iPhone as well.
I already did my session on Monday - My Session at Oracle Open World 2008 (Oracle Develop). It was attended very well, almost full room (60 people), and what is most important no errors in demo development. You can download application - OraMaps11_Session.zip, I have developed during my session:
JDeveloper 11g - CRUD in ADF Form Component
I'm again back to one of most popular topics on my blog - CRUD implementation in ADF. I was blogging previously about CRUD in 10g and also about CRUD in 11g af:table component - JDeveloper 11g - Create, Edit and Delete operations in ADF Faces af:table component. Today I want to describe CRUD in ADF Form implementation, it is different comparing to ADF Table implementation. Actually, its easy to implement CRUD operations in ADF Form, however it can be complex to implement user friendly CRUD behavior. Main focus of my blog post will be to describe how to achieve user friendly CRUD behavior with ADF Form component.

This post is based on sample application I have developed - UndoCreate.zip. Sample is based on standard HR schema, before running application make sure you have correct DB connection defined.
1) Find Functionality
By default, when you are using ADF Search Form functionality, entered query parameters are stored and are shown again when user will re-open form in Find mode. However, based on my experience, usually it is not a desired behavior. Users prefer not to see old query parameters when they re-open form in Find mode. For example, when some query parameter is entered:

Search is executed and result returned:

And now, when user will press Find button again, previous query criteria should be cleared. It is not cleared by default in ADF, however it is cleared in my sample application:

I'm clearing previous query parameters by executing combination of Rollback, Find, Delete and Create actions in backing bean findButton_action() method associated with Find button.
2) Find Functionality - No Results
When user enters query parameter, that will not give any result, and press Search button - empty form will be returned by default. Example of non-existing query criteria:

Empty form returned by default:

In my sample application, I have changed this default behavior in executeButton_action() method in backing bean. I'm doing a check - if iterator is empty, I'm returning to Find mode and displaying information message - 'No Results found!':

In this case I'm not clearing entered query criteria.
3) Undo Functionality in Create Mode
When form is in Create mode, user usually prefer to have 3 choices - to store entered data and to go to Edit mode, to clear entered data and to remain in Create mode, and to close Create mode by opening form in Find mode:

If with 2 cases - to store entered data or to open form in Find mode everything is less or more okej, there is a problem with a case when user wants to clear entered data and to remain in Create mode. With default Undo functionality, when using only Rollback action, user will be navigated back to Edit mode. In order to change this, I'm re-invoking Create mode initialization from backing bean in undoButton_action() method, it is invoked after default Rollback action. This allows to clear entered data and to stay in Create mode after Undo button is pressed:

4) Undo Functionality in Edit Mode
By default, when Undo button is pressed while in Edit mode and Rollback action is executed, changes will be discarded and at the same time form will be refreshed and will show first row from iterator. This means, user will be navigate from a row he is currently editing to a first row in iterator.
To make this behavior more user friendly, I have implemented custom Rollback functionality in undoButton_action() method in backing bean:

In this code, I'm acquiring form related iterator, getting current row user is editing and refreshing it. At the end, I'm applying Partial refresh to a form in order to display correct data. More information about Rollback functionality you can find in Chris Muir blog post - JDeveloper and the art of the rollback. The same functionality can be applied not only in 11g, but in 10g as well.
With implemented functionality, if user is editing data:

And decides to remove all changes by pressing Undo button, form will remain on the same row:

5) Delete Functionality
When user executes Delete functionality, I can recommend to commit transaction at the same time. In developed sample application, when Delete button is pressed - deleteButton_action() method is invoked, where confirmation popup is opened:

When user confirms Delete action, Commit action is executed at the same time, and row is removed from database.
6) Delete Functionality - Last Row
By default, after user will delete last row from iterator, empty form will be rendered:

Such behavior is not user friendly, much better to navigate to Find mode automatically:

This logic is implemented in deleteDialogListener(DialogEvent dialogEvent) method in backing bean:

7) Confirm or Undo Pending Changes
When user is editing data and there are pending changes (before commit or rollback), based on my experience its better not allow to navigate from current row. For example, when data is changed and there are pending changes:

Buttons related to form logic - Find, Create, Delete and buttons related to form navigation - First, Previous, Next and Delete are blocked. Information message is shown - 'Save or Undo Changes First!' asking user to confirm or dismiss current pending changes:

Information about pending changes is retrieved from bindings.Commit.enabled using Expression Language. Its enough to edit data available in the form and bindings.Commit.enabled will return true.

This post is based on sample application I have developed - UndoCreate.zip. Sample is based on standard HR schema, before running application make sure you have correct DB connection defined.
1) Find Functionality
By default, when you are using ADF Search Form functionality, entered query parameters are stored and are shown again when user will re-open form in Find mode. However, based on my experience, usually it is not a desired behavior. Users prefer not to see old query parameters when they re-open form in Find mode. For example, when some query parameter is entered:

Search is executed and result returned:

And now, when user will press Find button again, previous query criteria should be cleared. It is not cleared by default in ADF, however it is cleared in my sample application:

I'm clearing previous query parameters by executing combination of Rollback, Find, Delete and Create actions in backing bean findButton_action() method associated with Find button.
2) Find Functionality - No Results
When user enters query parameter, that will not give any result, and press Search button - empty form will be returned by default. Example of non-existing query criteria:

Empty form returned by default:

In my sample application, I have changed this default behavior in executeButton_action() method in backing bean. I'm doing a check - if iterator is empty, I'm returning to Find mode and displaying information message - 'No Results found!':

In this case I'm not clearing entered query criteria.
3) Undo Functionality in Create Mode
When form is in Create mode, user usually prefer to have 3 choices - to store entered data and to go to Edit mode, to clear entered data and to remain in Create mode, and to close Create mode by opening form in Find mode:

If with 2 cases - to store entered data or to open form in Find mode everything is less or more okej, there is a problem with a case when user wants to clear entered data and to remain in Create mode. With default Undo functionality, when using only Rollback action, user will be navigated back to Edit mode. In order to change this, I'm re-invoking Create mode initialization from backing bean in undoButton_action() method, it is invoked after default Rollback action. This allows to clear entered data and to stay in Create mode after Undo button is pressed:

4) Undo Functionality in Edit Mode
By default, when Undo button is pressed while in Edit mode and Rollback action is executed, changes will be discarded and at the same time form will be refreshed and will show first row from iterator. This means, user will be navigate from a row he is currently editing to a first row in iterator.
To make this behavior more user friendly, I have implemented custom Rollback functionality in undoButton_action() method in backing bean:

In this code, I'm acquiring form related iterator, getting current row user is editing and refreshing it. At the end, I'm applying Partial refresh to a form in order to display correct data. More information about Rollback functionality you can find in Chris Muir blog post - JDeveloper and the art of the rollback. The same functionality can be applied not only in 11g, but in 10g as well.
With implemented functionality, if user is editing data:

And decides to remove all changes by pressing Undo button, form will remain on the same row:

5) Delete Functionality
When user executes Delete functionality, I can recommend to commit transaction at the same time. In developed sample application, when Delete button is pressed - deleteButton_action() method is invoked, where confirmation popup is opened:

When user confirms Delete action, Commit action is executed at the same time, and row is removed from database.
6) Delete Functionality - Last Row
By default, after user will delete last row from iterator, empty form will be rendered:

Such behavior is not user friendly, much better to navigate to Find mode automatically:

This logic is implemented in deleteDialogListener(DialogEvent dialogEvent) method in backing bean:

7) Confirm or Undo Pending Changes
When user is editing data and there are pending changes (before commit or rollback), based on my experience its better not allow to navigate from current row. For example, when data is changed and there are pending changes:

Buttons related to form logic - Find, Create, Delete and buttons related to form navigation - First, Previous, Next and Delete are blocked. Information message is shown - 'Save or Undo Changes First!' asking user to confirm or dismiss current pending changes:

Information about pending changes is retrieved from bindings.Commit.enabled using Expression Language. Its enough to edit data available in the form and bindings.Commit.enabled will return true.
Oracle JDeveloper/ADF Developers Wanted
In my current Oracle JDeveloper/ADF project we are searching for additional developers. Project is based on Oracle Fusion 11g, so it can be excellent opportunity for you to get experience with a new Oracle JDeveloper/ADF release. However, if you already have knowledge in 11g, it will be only a benefit.
If you are interested, drop me an email with Resume. If it will be needed, I will be glad to provide more details.
If you are interested, drop me an email with Resume. If it will be needed, I will be glad to provide more details.
Custom LOV Type Functionality in JDeveloper 11g
JDeveloper 11g together with Oracle ADF provides fully functional LOV component, in 11g you can define LOV in Model, for specific attribute in View Object (ADF BC). However, at the moment there is problem with non-model LOV, main problem - Search region for non-model based LOV not available. For example, you can check my previous sample application, developed with JDeveloper 11g TP3 - List-Of-Values Component in Search and Edit Form. In this application, I was using non-model LOV, it was based on variable in Page Definition. However, same type LOV appears differently in JDeveloper 11g TP4 - without Search region, and its not clear if it will have Search region in next release.
So, what I want to say - usually its not recommended to reinvent the weel, but in practice every developer should know how to implement similar component functionality manually. With Oracle ADF you can implement your own LOV, but if you can wait for new release, or not facing problems with standard component, may be there is no need to implement own...
You can download my sample application - CustomLOV.zip. This application demonstrates how to implement own LOV functionality. Next step will be to implement custom ADF reusable component for LOV. Similar as Glasspane ADF reusable component - Glasspane in ADF Faces RC.
Now I will describe main steps, you can follow if there will be a need to have custom LOV type functionality.
First, we need somehow to open dialog window, it can be done relatively straightforward - to put af:clientListener operation on selected af:inputText field and specify dbClick type for this action. This will allow to raise popup with LOV when dbClick event will be catched.

Popup with our custom LOV is opened using Javascript function.
LOV is based on two sections - Search parameters and table with Results:

Main trick in this application is applied for row selection from LOV. Its not a problem to select row and return it by pressing OK button. But, its little bit more complex to return selected row just by double clicking on any row. Its a problem, because selection event is fired on single selection click, but not on on double click. However, you shouldn't forget - we are using ADF, almost all problems can be solved here ;) So, what i did - I have set af:clientListener with dbClick type for Results table and additionally have set af:serverListener for the same Results table.

Idea - when user performs double click event, Javascript client listener function is invoked and this Javascript function invokes Java method declared in af:serverListener. This Java method basically will retrieve current row from Results table iterator - thats all.
Here are two Javascript functions from developed sample application:

First function is responsible for popup with LOV invocation, second reacts to dbClick event in Results table.
Java code in Backing bean is concentrated into three main methods:

First method works as Dialog Listener, this means is invoked when LOV is closed using OK button. Second method is invoked from Javascript client listener function, when dbClick event is catched in LOV Results table. Third function just retrieving value selected in LOV and assigning it to parent field.
In sample application, LOV is defined for LocationId field, just double click on this field:

Our custom LOV is opened with Search region and Results table:

You see, LOV looks like standard Oracle one, however may be even better - possible to control Results table size :) And finally, when row in Results table is double clicked, selected data is returned to parent component:

So, what I want to say - usually its not recommended to reinvent the weel, but in practice every developer should know how to implement similar component functionality manually. With Oracle ADF you can implement your own LOV, but if you can wait for new release, or not facing problems with standard component, may be there is no need to implement own...
You can download my sample application - CustomLOV.zip. This application demonstrates how to implement own LOV functionality. Next step will be to implement custom ADF reusable component for LOV. Similar as Glasspane ADF reusable component - Glasspane in ADF Faces RC.
Now I will describe main steps, you can follow if there will be a need to have custom LOV type functionality.
First, we need somehow to open dialog window, it can be done relatively straightforward - to put af:clientListener operation on selected af:inputText field and specify dbClick type for this action. This will allow to raise popup with LOV when dbClick event will be catched.

Popup with our custom LOV is opened using Javascript function.
LOV is based on two sections - Search parameters and table with Results:

Main trick in this application is applied for row selection from LOV. Its not a problem to select row and return it by pressing OK button. But, its little bit more complex to return selected row just by double clicking on any row. Its a problem, because selection event is fired on single selection click, but not on on double click. However, you shouldn't forget - we are using ADF, almost all problems can be solved here ;) So, what i did - I have set af:clientListener with dbClick type for Results table and additionally have set af:serverListener for the same Results table.

Idea - when user performs double click event, Javascript client listener function is invoked and this Javascript function invokes Java method declared in af:serverListener. This Java method basically will retrieve current row from Results table iterator - thats all.
Here are two Javascript functions from developed sample application:

First function is responsible for popup with LOV invocation, second reacts to dbClick event in Results table.
Java code in Backing bean is concentrated into three main methods:

First method works as Dialog Listener, this means is invoked when LOV is closed using OK button. Second method is invoked from Javascript client listener function, when dbClick event is catched in LOV Results table. Third function just retrieving value selected in LOV and assigning it to parent field.
In sample application, LOV is defined for LocationId field, just double click on this field:

Our custom LOV is opened with Search region and Results table:

You see, LOV looks like standard Oracle one, however may be even better - possible to control Results table size :) And finally, when row in Results table is double clicked, selected data is returned to parent component:

JBO-25058 and JBO-26001 exceptions
In a case if you will get JBO-25058 and JBO-26001 exceptions after running application developed with Oracle ADF in JDeveloper 11g, most probably my post will help you.
Those exceptions can be thrown, after refactoring Model part implemented with ADF BC. If Business Components Project file with extension *.jpx is moved to different package, jbo.project property available in bc4j.xcfg file must be changed accordingly. However, it is not changed always automatically. If its not changed, two exceptions will appear at runtime:
1) oracle.security.jazn.JAZNRuntimeException: JBO-25058: Definition JobTitle of type Attribute not found in JobTitle
2) oracle.jbo.NoXMLFileException: JBO-26001: XML File not found for the Container /Model.jpx
In order to solve this issue, double check bc4j.xcfg, ADF BC configuration file. For example, if Model.jpx file (this file can have different name in your project) is in lt.andrejusb.model package, jbo.project property in bc4j.xcfg file must be equal to jbo.project="lt.andrejusb.model.Model".
Those exceptions can be thrown, after refactoring Model part implemented with ADF BC. If Business Components Project file with extension *.jpx is moved to different package, jbo.project property available in bc4j.xcfg file must be changed accordingly. However, it is not changed always automatically. If its not changed, two exceptions will appear at runtime:
1) oracle.security.jazn.JAZNRuntimeException: JBO-25058: Definition JobTitle of type Attribute not found in JobTitle
2) oracle.jbo.NoXMLFileException: JBO-26001: XML File not found for the Container /Model.jpx
In order to solve this issue, double check bc4j.xcfg, ADF BC configuration file. For example, if Model.jpx file (this file can have different name in your project) is in lt.andrejusb.model package, jbo.project property in bc4j.xcfg file must be equal to jbo.project="lt.andrejusb.model.Model".
Show Buttons based on Disclosed Tab
In 11g it becomes quite common use case to structure application page with tabbed panels. If you develop your pages based on templates, most probably there will be separate area for buttons implemented with af:toolbar tag. And this area will not be included into tabbed panel, since template usually will not contain panel elements. Here is example of such structure:

You will face a problem with this structure, when there will be requirement to display different sets of buttons based on different tab (in Oracle ADF, currently opened tab is called - disclosed). This means, area with buttons should be updated, each time user changes current tab.
You can download sample application, where described case is implemented - TabsButtonsDynamic.zip. This sample contains three tabs - Countries, Jobs and Departments. Based on tab currently selected, different buttons are rendered. However, all buttons are initially created on the page, just rendered conditionally.
There are three steps, in order to have buttons conditionally rendered based on currently disclosed tab:
1. Disclosure Listener
Since there is no AutoSubmit property for Tab component, we will use DisclosureListener in order to catch event, when current tab is disclosed:

In this case, we can use the same DisclosureListener for all Tabs.
2. Partial Target
Generated DisclosureListener method will contain only one line of code - it will refresh af:toolbar area with buttons.

As you have noticed, there is no need to refresh each button individually, its enough to apply partial target to toolbar.
3. Rendered property
Each button should have conditional Rendered property.

This property will return boolean value based on currently disclosed tab.
Thats all, really simple and straightforward solution.
If you will run developed sample application, you will notice 4 buttons displayed while in Countries tab - First, Previous, Next and Last:

There will be 2 buttons in Jobs tab - Create and Save:

Finally, 1 button in Departments tab - Save:


You will face a problem with this structure, when there will be requirement to display different sets of buttons based on different tab (in Oracle ADF, currently opened tab is called - disclosed). This means, area with buttons should be updated, each time user changes current tab.
You can download sample application, where described case is implemented - TabsButtonsDynamic.zip. This sample contains three tabs - Countries, Jobs and Departments. Based on tab currently selected, different buttons are rendered. However, all buttons are initially created on the page, just rendered conditionally.
There are three steps, in order to have buttons conditionally rendered based on currently disclosed tab:
1. Disclosure Listener
Since there is no AutoSubmit property for Tab component, we will use DisclosureListener in order to catch event, when current tab is disclosed:

In this case, we can use the same DisclosureListener for all Tabs.
2. Partial Target
Generated DisclosureListener method will contain only one line of code - it will refresh af:toolbar area with buttons.

As you have noticed, there is no need to refresh each button individually, its enough to apply partial target to toolbar.
3. Rendered property
Each button should have conditional Rendered property.

This property will return boolean value based on currently disclosed tab.
Thats all, really simple and straightforward solution.
If you will run developed sample application, you will notice 4 buttons displayed while in Countries tab - First, Previous, Next and Last:

There will be 2 buttons in Jobs tab - Create and Save:

Finally, 1 button in Departments tab - Save:

Oracle ACE Office Hours in the OTN Lounge
Today I got email from Oracle people about Oracle ACE "Office Hours" activity in the OTN Lounge during Oracle OpenWorld 2008.
Main idea of those "Office Hours" is to create opportunity for Oracle ACE's and Oracle ACE Directors to meet with conference participants and to answer possible questions.
I will be on duty after lunch on Monday, September 22 and will be happy to discuss daily things related to JDeveloper/ADF development, and not only...
See you there !
Main idea of those "Office Hours" is to create opportunity for Oracle ACE's and Oracle ACE Directors to meet with conference participants and to answer possible questions.
I will be on duty after lunch on Monday, September 22 and will be happy to discuss daily things related to JDeveloper/ADF development, and not only...
See you there !
JDeveloper 11g on Mac OS X Leopard
I'm using Apple Mac Book Pro for about half of a year, but shame for me all this time I was running Windows OS using Apple Boot Camp solution. This product allows to install and run Windows OS on Apple computer exactly the same as on usual PC.
However, I decided to switch to Mac OS X Leopard and to do my work under this OS. I'm glad for this decision, looks like Mac OS is increasing my productivity through user-friendly and helpful interface environment :)
For my usual work I need Oracle XE database, Oracle SQL Developer and Oracle JDeveloper. Its only one little problem with Oracle XE, since this database is not supported in Mac OS. But, it is supported in Ubuntu Linux, so I installed Ubuntu as Virtual Machine (using VMware Fusion) and configured Oracle XE in this OS:

I have installed Oracle XE on Ubuntu using help from this tutorial - Installing Oracle XE on Debian, Ubuntu, and Kubuntu.
In order to use Oracle XE service from Mac OS, I just need to access database using IP assigned for Ubuntu VM by VMware Fusion:

JDeveloper 11g can be launched directly in Mac OS. Before running JDeveloper, I have downloaded and installed JVM from SUN. In order to run JDeveloper under Mac OS its enough to double-click jdev script file available in JDEV_HOME/jdev/bin directory:

For example, ADF BC wizard with applied Mac OS theme looks like this:

If you dont like it, its possible to use default JDeveloper theme even in Mac OS:

This image shows how JDeveloper looks with Mac OS theme:

And finally, application developed with JDeveloper 11g is running in Mozilla Firefox 3.0:

However, I decided to switch to Mac OS X Leopard and to do my work under this OS. I'm glad for this decision, looks like Mac OS is increasing my productivity through user-friendly and helpful interface environment :)
For my usual work I need Oracle XE database, Oracle SQL Developer and Oracle JDeveloper. Its only one little problem with Oracle XE, since this database is not supported in Mac OS. But, it is supported in Ubuntu Linux, so I installed Ubuntu as Virtual Machine (using VMware Fusion) and configured Oracle XE in this OS:

I have installed Oracle XE on Ubuntu using help from this tutorial - Installing Oracle XE on Debian, Ubuntu, and Kubuntu.
In order to use Oracle XE service from Mac OS, I just need to access database using IP assigned for Ubuntu VM by VMware Fusion:

JDeveloper 11g can be launched directly in Mac OS. Before running JDeveloper, I have downloaded and installed JVM from SUN. In order to run JDeveloper under Mac OS its enough to double-click jdev script file available in JDEV_HOME/jdev/bin directory:

For example, ADF BC wizard with applied Mac OS theme looks like this:

If you dont like it, its possible to use default JDeveloper theme even in Mac OS:

This image shows how JDeveloper looks with Mac OS theme:

And finally, application developed with JDeveloper 11g is running in Mozilla Firefox 3.0:

Glasspane in ADF Faces RC
You can build very cool systems, based on excellent architecture design, with ADF BC or EJB in Model layer and with ADF Task Flows in View Controller layer. However, when it comes time for functional test, tester can break all things only with one question - why when I pressed Apply button and at the same time have pressed couple of other buttons, I got some unexpected result? Well, you probably will answer - you need to wait after Apply button is pressed some minute until operation will be finished and only after it will be done you can press other buttons. I'm sure, tester will not be satisfied with such answer, and application will not be accepted. However, things are not so bad as you can imagine, Frank Nimphius have described how to block page screen during long operation - How-to build a reusable Glasspane in ADF Faces RC. Please read Frank's article, before reading my post, since current post is completely based on it. Here I will describe with sample application how to refresh the screen to show the visual results of the long running operation.
Developed sample application - GlassPaneTest.zip is based on HR schema from Oracle XE database and implements one JSPX page with search form and results table. When you will open this application in JDeveloper 11g, be sure GlassPane reusable component (JAR file) is in correct path. You can check this in JSP Tag Libraries section by opening Project Properties for ViewController:

In this application I'm running two 'long' operations:

Here is the code from Backing bean, where Glasspane is launched and closed:

There are 3 additions comparing to original Frank Nimphius article:

When I'm running this application and doing Search operation, Glasspane appears and not allows to do any changes until operation is not finished:

After operation is finished and result is returned, Glasspane disappears and user can continue his/her work:

Same applies for Save button, during Commit operation screen is blocked and user can relax until operation will be done and Glasspane will disappear :)

Additionally, in ADF Faces RC its possible to use Blocking=True property for buttons. However in most cases its not useful, since user still can do changes on the screen.
Useful Update:
While integrating Glass Pane solution into our project, JDeveloper/ADF developer have found nice improvement. Instead of using refreshCurrentPage() method you can set PartialTriggers property for af:form tag and indicate dependency with Glass Pane popup (for example, in my sample application it will be - af:form partialtriggers="gp:busyPopup"). With this setting, page content is refreshed after popup is closed, without rerendering full page.
Developed sample application - GlassPaneTest.zip is based on HR schema from Oracle XE database and implements one JSPX page with search form and results table. When you will open this application in JDeveloper 11g, be sure GlassPane reusable component (JAR file) is in correct path. You can check this in JSP Tag Libraries section by opening Project Properties for ViewController:
In this application I'm running two 'long' operations:
- filterEmployees(String firstName, String lastName) custom method from Application Module implementation class
- Simple Commit action
Here is the code from Backing bean, where Glasspane is launched and closed:
There are 3 additions comparing to original Frank Nimphius article:
- In onAction(ActionEvent actionEvent) method, I'm storing Id of button component that currently activates Glasspane. I'm doing this, in order to know what logic should I invoke in queryToLaunch(ClientEvent evt) method.
- When Glasspane component is activated, it calls back queryToLaunch(ClientEvent evt) method. In this method I'm accessing stored variable with currently pressed button Id and invoking appropriate functionality.
- In order to present visual changes when operation is finished, I'm calling refreshCurrentPage() method that is doing refresh of the current page:
When I'm running this application and doing Search operation, Glasspane appears and not allows to do any changes until operation is not finished:
After operation is finished and result is returned, Glasspane disappears and user can continue his/her work:
Same applies for Save button, during Commit operation screen is blocked and user can relax until operation will be done and Glasspane will disappear :)
Additionally, in ADF Faces RC its possible to use Blocking=True property for buttons. However in most cases its not useful, since user still can do changes on the screen.
Useful Update:
While integrating Glass Pane solution into our project, JDeveloper/ADF developer have found nice improvement. Instead of using refreshCurrentPage() method you can set PartialTriggers property for af:form tag and indicate dependency with Glass Pane popup (for example, in my sample application it will be - af:form partialtriggers="gp:busyPopup"). With this setting, page content is refreshed after popup is closed, without rerendering full page.
ADF Methodology For The Masses on OOW'08
Good news for all JDeveloper/ADF developers - ADF development methodology is in the process, Oracle community is defining it and it'll be available soon. You can track our progress on Oracle Wiki page - ADF Methodology. I believe this methodology will help a lot in daily life, since it will be good reference with descriptions how things should be done in JDeveloper/ADF.
I know its always fun to develop prototypes, but when you in real project, usually you need to have some standard about how to structure application packages, how to define names for components in Model and ViewController layers, and how to find meaningful names for navigation links in application Task Flow. Other important area - reusability. Developers always should reuse code, however how its to do better in ADF, will be described in ADF Methodology. Everyone is free to suggest topics for ADF Methodology, just visit our page on Oracle Wiki.
If you will be on OOW'08, you can register here and attend workshop dedicated to ADF Methodology. Also, you can see how work is progressing on Google Groups - here.
I hope ADF Methodology For The Masses will be same cool as songs from Depeche Mode album - Music For The Masses :-)
See you there in San Francisco !
I know its always fun to develop prototypes, but when you in real project, usually you need to have some standard about how to structure application packages, how to define names for components in Model and ViewController layers, and how to find meaningful names for navigation links in application Task Flow. Other important area - reusability. Developers always should reuse code, however how its to do better in ADF, will be described in ADF Methodology. Everyone is free to suggest topics for ADF Methodology, just visit our page on Oracle Wiki.
If you will be on OOW'08, you can register here and attend workshop dedicated to ADF Methodology. Also, you can see how work is progressing on Google Groups - here.
I hope ADF Methodology For The Masses will be same cool as songs from Depeche Mode album - Music For The Masses :-)
See you there in San Francisco !
My Session at Oracle Open World 2008 (Oracle Develop)
I was posting some time ago, Oracle selected my abstract to be presented on OOW'08 in San Francisco - Oracle Open World 2008 - Abstract Accepted.
Here is my session details:
Session ID: S300476
Session Title: Oracle Maps in Oracle JDeveloper 11g: A Perfect Combination
Track: Oracle Develop: Java
Date/Time: Monday 09/22/2008 13:00 - 14:00
Venue/Room: Marriott Salon 03
Here is the sample screen of application I will explain during my session:

See you there, in San Francisco !
Here is my session details:
Session ID: S300476
Session Title: Oracle Maps in Oracle JDeveloper 11g: A Perfect Combination
Track: Oracle Develop: Java
Date/Time: Monday 09/22/2008 13:00 - 14:00
Venue/Room: Marriott Salon 03
Here is the sample screen of application I will explain during my session:
See you there, in San Francisco !
LOV in Find Mode - Workaround for JDeveloper 11g TP4
During this week I have faced an issue with LOV functionality when form is switched to Find mode. I got reply from Oracle, this issue is a bug in JDeveloper 11g. However, for those who need to use LOV components in Find mode in your current project, I will provide temporary workaround. Temporary, I hope until next JDeveloper 11g build.
You can download sample application, where LOV in Find mode works with applied workaround - LOVFindMode.zip. Developed sample contains one form with LOV component.

Its possible to switch this form to Find mode by pressing Find button.

Before describing workaround, I want to remind you about one trick I have noticed with LOV read-only View objects. When you generate Model layer using ADF Business Components From Tables wizard, KeyAttributes property for read-only LOV View objects is not set for some reason. As a result, after value in LOV popup is selected:

Nothing is returned back:

In order to fix this, open your read-only View object you are using for LOV:

And specify key attributes, you can do this directly in XML or through wizard:

Ok, now let's back to main topic of this post - workaround for LOV when form is in Find mode. At first, you can ask - where is the problem? Its easy to answer - select value from LOV popup for first time:

Press LOV icon second time, in order to change selected value - oracle.jbo.SQLStmtException: JBO-27122 is thrown:

For some reason, ADF constructs SQL statement with :vc_temp_1 bind variable, and this variable is not initialized:
oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE (( (Employees.JOB_ID LIKE :vc_temp_1 ) ) AND Employees.EMPLOYEE_ID = :1)
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
Its Oracle bug, and they will fix it next build, but for those who need to use LOV in Find mode with TP4, may be my workaround will be helpful.
While researching this problem, I have noticed that value from LOV is returned still correctly, even after exception is thrown. So, workaround is simple - just to hide generated exception. In 11g you can use centralized custom error handler class where reported exceptions can be managed.

This class should extend from DCErrorHandlerImpl class and should be registered in DataBindings.cpx file:

I'm catching generated exception in overrided reportException method and not reporting it, all other exceptions are reported as normal:

When this workaround is applied, you can open LOV popup when form is in Find mode as many times as you want - no error popup, and value from LOV is returned:

If you will check your server log, you will find entry that indicates information about catched but not reported exception:

You can download sample application, where LOV in Find mode works with applied workaround - LOVFindMode.zip. Developed sample contains one form with LOV component.
Its possible to switch this form to Find mode by pressing Find button.
Before describing workaround, I want to remind you about one trick I have noticed with LOV read-only View objects. When you generate Model layer using ADF Business Components From Tables wizard, KeyAttributes property for read-only LOV View objects is not set for some reason. As a result, after value in LOV popup is selected:
Nothing is returned back:
In order to fix this, open your read-only View object you are using for LOV:
And specify key attributes, you can do this directly in XML or through wizard:
Ok, now let's back to main topic of this post - workaround for LOV when form is in Find mode. At first, you can ask - where is the problem? Its easy to answer - select value from LOV popup for first time:
Press LOV icon second time, in order to change selected value - oracle.jbo.SQLStmtException: JBO-27122 is thrown:
For some reason, ADF constructs SQL statement with :vc_temp_1 bind variable, and this variable is not initialized:
oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE (( (Employees.JOB_ID LIKE :vc_temp_1 ) ) AND Employees.EMPLOYEE_ID = :1)
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
Its Oracle bug, and they will fix it next build, but for those who need to use LOV in Find mode with TP4, may be my workaround will be helpful.
While researching this problem, I have noticed that value from LOV is returned still correctly, even after exception is thrown. So, workaround is simple - just to hide generated exception. In 11g you can use centralized custom error handler class where reported exceptions can be managed.
This class should extend from DCErrorHandlerImpl class and should be registered in DataBindings.cpx file:
I'm catching generated exception in overrided reportException method and not reporting it, all other exceptions are reported as normal:
When this workaround is applied, you can open LOV popup when form is in Find mode as many times as you want - no error popup, and value from LOV is returned:
If you will check your server log, you will find entry that indicates information about catched but not reported exception:
UKOUG 2008 Conference
I was informed this week, my paper - ADF Task Flow - Based On Practical JDeveloper 11g Experience is selected for UKOUG 2008 Conference (1st - 5th December 2008, ICC, Birmingham).
Really good news for me and I was happy to hear because this year it was high competition for abstract selection, read Grant Ronald blog post - UKOUG Paper selection bun fight.
During my session I will talk and will demonstrate how we are using ADF Task Flow features in our projects. You should expect deep technical level presentation, see you there in December ;-)
Really good news for me and I was happy to hear because this year it was high competition for abstract selection, read Grant Ronald blog post - UKOUG Paper selection bun fight.
During my session I will talk and will demonstrate how we are using ADF Task Flow features in our projects. You should expect deep technical level presentation, see you there in December ;-)
BGOUG Autumn' 2008 Conference
I was in Bulgaria last year Sofia - Beautiful City and this year I'm going again. I'm invited to deliver presentation on BGOUG (Bulgarian Oracle User Group) Conference during October 24th - 26th in Bansko.
My session title - Business Rules Implementation with JDeveloper/ADF 11g. Main problem that will be addressed in this session is about how to map business rules implemented in Oracle Forms to Model-View-Controller (MVC) architectural pattern. I will give clear understanding about common business rules in Oracle Forms world and how to develop those rules in J2EE world with ADF Business Components in Model layer, ADF Task Flow in Controller layer and ADF Faces Rich Client in View layer.
My session title - Business Rules Implementation with JDeveloper/ADF 11g. Main problem that will be addressed in this session is about how to map business rules implemented in Oracle Forms to Model-View-Controller (MVC) architectural pattern. I will give clear understanding about common business rules in Oracle Forms world and how to develop those rules in J2EE world with ADF Business Components in Model layer, ADF Task Flow in Controller layer and ADF Faces Rich Client in View layer.
ODTUG 2008 Gallery from Frans Thamura
It was great time on ODTUG Kaleidoscope 2008 in New Orleans this year. Frans Thamura, Oracle ACE Director and friend from Indonesia, have posted on his blog pics from this event - ODTUG 2008 Gallery. Enjoy ! :)
Import Functionality in Oracle ADF BC
By default, when you create new application in JDeveloper based on Fusion Web Application (ADF) template, two projects are generated - Model and ViewController. However, very often in real projects its not practical to have all ADF BC components just in one Model project. With one very big Model project it becomes quite complex to maintain application and usually when there are let's say around 200 components in one Model project, tool starts to work more slowly.
So, as you probably understood, there is a best practice to separate Model project into smaller projects and reuse ADF BC components across those projects. Goal of this post will be to tell you how to do Model project splitting. You can download sample application I have developed - ADFBC_Import.zip. As usually, this application is based on standard HR schema, available in Oracle XE database.
Developed sample contains three projects - Model, ModelShared and ViewController:

ModelShared holds one EO - Countries, this component will be imported into main Model project. In order to import and use Countries in separate Model project, we need to build JAR file for ModelShared:

Only Countries EO and ModelShared.jpx (describes ADF Business Components in current project) will be included into JAR file:

When Deployment Profile is declared, just build JAR file for ModelShared:

Now, we can reuse Countries EO in main Model project, and build Associations, View Links, View Objects based on imported Countries EO, even it is not visible in current project structure:

Import is done in Model.jpx, ADF BC description file, by adding JAR file with ModelShared project:

When import will be done, you can see imported Counties EO in all ADF BC wizards for Model project. For example, its possible to create Association between Regions and imported Countries:

Its possible in standard way to create VO based on imported EO:

Data Control structure in Application Module also can reflect Master-Detail relationship between normal VO (RegionsView) and VO (CountriesView) which based on imported EO:

And finally, everything works on single Web page: Master-Detail relationship between Regions and Countries:

So, as you probably understood, there is a best practice to separate Model project into smaller projects and reuse ADF BC components across those projects. Goal of this post will be to tell you how to do Model project splitting. You can download sample application I have developed - ADFBC_Import.zip. As usually, this application is based on standard HR schema, available in Oracle XE database.
Developed sample contains three projects - Model, ModelShared and ViewController:
ModelShared holds one EO - Countries, this component will be imported into main Model project. In order to import and use Countries in separate Model project, we need to build JAR file for ModelShared:
Only Countries EO and ModelShared.jpx (describes ADF Business Components in current project) will be included into JAR file:
When Deployment Profile is declared, just build JAR file for ModelShared:
Now, we can reuse Countries EO in main Model project, and build Associations, View Links, View Objects based on imported Countries EO, even it is not visible in current project structure:
Import is done in Model.jpx, ADF BC description file, by adding JAR file with ModelShared project:
When import will be done, you can see imported Counties EO in all ADF BC wizards for Model project. For example, its possible to create Association between Regions and imported Countries:
Its possible in standard way to create VO based on imported EO:
Data Control structure in Application Module also can reflect Master-Detail relationship between normal VO (RegionsView) and VO (CountriesView) which based on imported EO:
And finally, everything works on single Web page: Master-Detail relationship between Regions and Countries:
Customizing Applications with MDS - Practical Overview
During ODTUG Kaleidoscope 2008, I was discussing with Shaun O'Brien (Principal Product Manager from Oracle Development Tools group) about new functionality offered in JDeveloper 11g - development of customizable applications with MDS. This functionality is very critical for us - consultants, because its very common requirement when there is a need to have the same application but with smaller or bigger differences for different clients. In this blog post, I will not describe how to enable MDS functionality in your application, because you can find all needed information for this topic on OTN, read this Cue Card - Customize and Personalize an Application. What I will show in this blog, is how you can apply MDS in your project from first day - develop customized validation rules.
My blog post is based on sample application I have created - MDSValidation.zip. MDS functionality is enabled based on the steps provided in Cue Card I have mentioned. In order to run this application in your environment, you will need to deploy a customization class - right click on Model project, and select Deploy -> to JAR file. After JAR file will be created, ensure it is available in
Developed application don't use any customizations in ViewController layer, only in Model. When I was developing it, at first I have generated ADF BC, have created ADF Task Flow and implemented JSPX page - nothing new, just common steps. When application was done, I decided to add 2 profiles - headquarters and remoteoffices. With headquarters profile active, validation rule is applied for Salary attribute in Employees entity. With remoteoffices profile active, no validation rules are applied. So, first things I did - I have deployed and registered customization class - SiteCC. Also have created customization.properties file, where active profile for my application is set:

After those 2 things were done, I have switched my JDeveloper 11g TP4 to Customization Developer role, in order to apply specific validation rule for headquarters profile:

JDeveloper 11g have restarted in order to apply required settings and I got Customizations Property tab available:

With headquarters role selected, I have opened Employees entity object wizard and defined specific validation rule on Entity level in order to compare Salary value with Minimal and Maximal salary values allowed for specific Job assigned for Employee:

When this rule was defined, metadata file related to headquarters role was created by JDeveloper. This metadata file contains customizations applied for selected role:

Ok, validation rule specific for selected role is defined, now we can switch back JDeveloper 11g to Default Role mode:

When JDeveloper 11g restarts in Default Mode, you can open Employees entity object wizard again, and check Validators section - no Validation rules. Its because, we have defined validation rule only for headquarters role and customizations are applied not only on runtime, but in development mode also:

When application will be deployed in production, its enough to set profile information in customization file:

And since there are no validation rules defined for remoteoffices profile, there is no validation applied for Salary attribute:

But, if second deployment will have different setting in customization file:

Validation rule defined for headquarters will be applied:

Looks like MDS is really very powerful feature in new JDeveloper release - JDeveloper 11g.
My blog post is based on sample application I have created - MDSValidation.zip. MDS functionality is enabled based on the steps provided in Cue Card I have mentioned. In order to run this application in your environment, you will need to deploy a customization class - right click on Model project, and select Deploy -> to JAR file. After JAR file will be created, ensure it is available in
JDEVELOPER_HOME\jdev\lib\patches\ directory.Developed application don't use any customizations in ViewController layer, only in Model. When I was developing it, at first I have generated ADF BC, have created ADF Task Flow and implemented JSPX page - nothing new, just common steps. When application was done, I decided to add 2 profiles - headquarters and remoteoffices. With headquarters profile active, validation rule is applied for Salary attribute in Employees entity. With remoteoffices profile active, no validation rules are applied. So, first things I did - I have deployed and registered customization class - SiteCC. Also have created customization.properties file, where active profile for my application is set:
After those 2 things were done, I have switched my JDeveloper 11g TP4 to Customization Developer role, in order to apply specific validation rule for headquarters profile:
JDeveloper 11g have restarted in order to apply required settings and I got Customizations Property tab available:
With headquarters role selected, I have opened Employees entity object wizard and defined specific validation rule on Entity level in order to compare Salary value with Minimal and Maximal salary values allowed for specific Job assigned for Employee:
When this rule was defined, metadata file related to headquarters role was created by JDeveloper. This metadata file contains customizations applied for selected role:
Ok, validation rule specific for selected role is defined, now we can switch back JDeveloper 11g to Default Role mode:
When JDeveloper 11g restarts in Default Mode, you can open Employees entity object wizard again, and check Validators section - no Validation rules. Its because, we have defined validation rule only for headquarters role and customizations are applied not only on runtime, but in development mode also:
When application will be deployed in production, its enough to set profile information in customization file:
And since there are no validation rules defined for remoteoffices profile, there is no validation applied for Salary attribute:
But, if second deployment will have different setting in customization file:
Validation rule defined for headquarters will be applied:
Looks like MDS is really very powerful feature in new JDeveloper release - JDeveloper 11g.



