Last year I blogged an entry on Using multiple faces-config.xml files in JSF. Without a doubt this is one of my more successful posts, as since it was published the blog entry has received over 5200 reads. Part of the success of the post is it applies to not specifically to JDeveloper or ADF Faces but rather JSF as a whole.
The original reason for segmenting the faces-config.xml file was to divide it into manageable chunks. Another advantage of multiple files which I didn't document was it allows developers to work on their own faces-config.xml in a team environment, or more specifically avoid the pain of version control on a shared single faces-config.xml file which is frequently changed. As developers rapidly make changes to the faces-config.xml file a file-version tug-of-war can break out, and a merge nightmare ensue.
In the 10.1.3 release there is another file which has the same issue which is specific to ADF Faces (ie. not JSF), namely the DataBindings.cpx file (accessible by default under the ViewController project - Application Sources - view package). The DataBindings.cpx keeps track of the individual page definitions files used within the project, as well as the DataControls mapping to such things as ADF Business Components Application Modules.
Within the JDev 10.1.3 release the web.xml file has a <context-param> entry that defines where the ADF Faces project finds the DataBindings.cpx file. Multiple entries (or files) are not supported.
As developers create new data bound web pages with new page definitions, the DataBindings.cpx file will frequently change. Integrating JDeveloper with Subversion means that developers will also have a frequent tug-of-war with this file under the 10.1.3 release, requiring frequent resynchronisation and merges. This is less than ideal; less mergers means less work, aggravation and chances of mistakes.
Within JDeveloper 11g this problem has been removed by the ability to create multiple DataBindings.cpx files. Instead of configuring the DataBindings.cpx file in the web.xml file, JDev 11g has a new configuration file adfm.xml that resides under the ViewController project - Application Sources - META-INF.
Within this file you can define each DataBindings file under a <DataBindingRegistry> tag. For example:
<?xml version="1.0" encoding="UTF-8" ?>
Note within JDev 11g the DataBindings files reside under the ViewController/adfmsrc/view directory. Ensure to create your additional DataBindings files here too.
In doing this there are some other things you must consider:
1. In each DataBindings file, you must also change the id attribute of the <Application> tag to match the DataBindings file name. For example for DataBindings1.cpx:
version="22.214.171.124.96" id="DataBindings1" SeparateXMLFiles="false"
...and so on...
2. Also in the DataBindings file you must uniquely identify each Application Module Data Control usage by changing the id attribute of the <BC4JDataControl> tag.
I'm not yet sure, but I assume if you create 2 separate Application Module Data Control usages within the separate <BC4JDataControl> tags, you're creating 2 separate ADF BC transactions.
3. For existing and new page definition files that refer to the Data Controls from the previous step, you need to rename the Application Module Data Control reference. If you're using ADF BC for your model layer, this will typically appear in the <executables><iterator> DataControl attribute, as well as any <bindings><action> tags that refer to the DataControl (such as Commit and Rollback).
At this time when adding new web pages with new page definitions, I'm unsure how JDeveloper decides which DataBindings file to put the page definitions declarations. It appears to be by default DataBindings.cpx, otherwise it's the first DataBindings file listed in the adfm.xml file which is read in when the Workspace is opened. I can envisage that this will need to be a configurable setting in the ViewController project file sometime in the future.
Note if you get the above settings wrong, the behaviour of the running application will either be:
1) You'll receive the spinning blue Oracle logo - but a page will never load
2) Or on a browser refresh a JBO-25058 error exception stack similar to the following:
oracle.security.jazn.JAZNRuntimeException: JBO-25058: Definition BookingNo of type Attribute not found in BookingNo
at com.evermind[Oracle Containers for J2EE 11g (126.96.36.199.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:583)
...and so on...
There also appears to be a small issue at design time when viewing a page, switching to the binding view, no details will be shown if the bindings reside in the 2nd DataBindings file. This is easily subverted by opening directly the page definitions file.
Finally please note the above was written under JDev 11g TP3 and may change under your future 11g+ release. I haven't tested this under TP4 (I've been sitting on this post for sometime). Basically test-test-test.
Thanks to Frank Nimphius with his assistance in resolving some issues with this in the following OTN post. As Frank notes in the post this wasn't the original intention of this facility, but a useful side effect. As always test everything as your mileage may vary.