Ralf writes in with a question:
Lets say i have two AM's FooAM and BarAM and some service methods in BarAM need to invoke methods of FooAM.
Whats a good approach for this scenario ?
- In the service method of BarAM, create a root application module for FooAM, invoke the FooAM service method and when we're done remove the FooAM application module
- Reference the FooAM application module from BarAM Is there a big performance impact when using 1.?
ADF Business Components supports the ability for BarAM to aggregate an instance of FooAM that it can reuse. You do this on the "Application Modules" panel of the AM Editor for BarAM.
Just like when you include an instance of a view object in an AM and you assign it a member name, you assign a member name to the aggregated AM instance.If you name the nested instance of FooAM something like "FooService", then we will generate you a getter method in the BarAMImpl.java class called getFooService() that returns the FooAM instance.
So, when a method in BarAMImpl.java needs to invoke a method on its nested FooAM instance, it just does:
public void SomeMethodInBarAM() { /* some code here */ getFooService().someMethodInFooAM(); /* some other code here. */ }
You definitely do NOT want to use createRootApplicationModule() in this case.It would create a new transaction/connection as part of a separate top-level root application module.
Using this nested application module feature, the aggegrated application module component's methods are available for easy reuse, as well as its entire "data model" of view object instances. All nested application modules and view object instances contained by a top-level "root" application module instance share a single transaction/database-connection and entity object caches that are "owned" by that root application module.
9:30:20 AM
|