Understanding Nested Application Modules in Oracle ADF

Sharing is Caring

Application Module acts as a container for view Object and view Link business components that are used in a specific task. It provides data model and data control to show required information and perform the action for the client
An application module represents a single transaction and owns one database connection that’s why commit and rollback works for all view Objects inside an application module

In ADF we develop large enterprise applications using lots of business components, regions, dynamic regions and with each used application module there is an increment in connection count
We can handle it using nested application modules where ever possible

An application module can contain other application modules, Nested application modules are used where an AM can be used again for another transaction. The important thing about nested application modules is transaction and connection sharing, All nested application modules use the same transaction as the root application module

Here I am not taking any practical use case just showing how the use of nested application modules decrease DB connection count

Created a Fusion Web Application using Departments and Employees table of HR Schema and prepared two application module – DeptAM and EmpAM

DeptAM– It has Departments View Object
EmpAM– It has Employees View Object

Now created a page and dropped both view Object as af:table on page

see the pageDef source that shows two different data controls

    <variableIterator id="variables"/>
    <iterator Binds="DepartmentsVO1" RangeSize="25" DataControl="DeptAMDataControl" id="DepartmentsVO1Iterator"/>
    <iterator Binds="EmployeesVO1" RangeSize="25" DataControl="EmpAmDataControl" id="EmployeesVO1Iterator"/>

Now run and check connections in Weblogic Server Administration console, It shows 2 DB connections (one for each AM)

Now see what happens when we use nested application modules,
Create a new Application Module, name it as rootAm and add both application modules to it

You can see it appears under application data controls, Now drop both view Object on the page from rootAmDataControl 

and look at pagedef, both view Objects are of different application module but shares the same data control that is of the root application module

        <variableIterator id="variables"/>
        <iterator Binds="DeptAM1.DepartmentsVO1" DataControl="rootAmDataControl" RangeSize="25"
        <iterator Binds="EmpAm1.EmployeesVO1" DataControl="rootAmDataControl" RangeSize="25" id="EmployeesVO1Iterator"/>

Run the application and check connection count again, It shows 1 DB connection that is used by the root application module

So here we learned that this can be used when we import multiple application modules (reusable) in one app using application library (Jar files), In that scenario, We can create a root AM to avoid multiple DB connections

Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “Understanding Nested Application Modules in Oracle ADF”

  1. thanks for this interesting post
    but i didnot understand the last statement

    "So here we learnt that we can import multiple application module (reusable) in one app using application library (Jar files) and create a root AM to avoid multiple DB connections"

    what do u mean by import multiple application modules ? u mean to deploy the application to a jar file and import it in another application and then put its Application module nested under the another application 'application module' ?

  2. Hi Ashish,
    How does the commit operation work here, if the nested AM is committed then will the rootAM also gets committed or is it the vice versa?


Leave a Reply

Your email address will not be published. Required fields are marked *